Vane's Life
  • Home
  • GitHub
  • Blog (Legacy)
  • About
  • Emi's Life
Subscribe
Vilic Vane

Vilic Vane

14 posts published

https://twitter.com/vilicvane https://www.facebook.com/vilicvane

Validate plain object against TypeScript declaration

I used to find TypeScript comes in handy when we want to validate plain objects against existing TypeScript declarations: such as validating configuration files, data migration results etc. I had written some simple utility functions that basically put generated JSON into a TypeScript file and type check it with the

  • Vilic Vane
Vilic Vane Nov 15, 2019 • 1 min read
Write Slack slash commands with Clime (TypeScript + Node.js)
TypeScript

Write Slack slash commands with Clime (TypeScript + Node.js)

Slack slash commands is one of the major interfaces interacting with a Slack integration. It is quite easy to integrate different functionalities with Slack slash commands. And this post will introduce a practice using TypeScript command-line interface framework Clime. Please note that the following content is not by any mean

  • Vilic Vane
Vilic Vane Nov 6, 2017 • 4 min read
JavaScript

Eval Locally with Persistent Context

I've been working on a remote console as part of our IoT JavaScript platform Ruff. The console needs to evaluate expressions with following constraints: It needs to evaluate inside an immediately called function. We are compiling modules within an immediately called function just like what Node.js does. Developer might

  • Vilic Vane
Vilic Vane Apr 4, 2016 • 1 min read
VS Code

VS Code: Open User-defined Console like ConEmu at Project Directory

For me Ctrl/Cmd+Shift+C is a convenient way to open a command prompt or terminal to execute some commands. However currently Visual Studio Code does not support specifying custom console yet. I mentioned how to modify VS Code program files to achieve this, but as now we can

  • Vilic Vane
Vilic Vane Dec 17, 2015 • 1 min read
VS Code

Code in Real-world TypeScript with Node.js, Step by Step

As a great tool for JavaScript, TypeScript is trending. However, it's still new and you may be confused how would one actually use TypeScript in real world? I've been using TypeScript in my projects since 1.0. In this post, I will create a website in TypeScript, with real-world file

  • Vilic Vane
Vilic Vane Nov 22, 2015 • 3 min read
Node.js

Use Nexe with Commander.js Sub Commands

Nexe is a command-line utility that compiles your Node.js application into a single executable file. And Commander.js is the most popular command-line interfaces solution for Node.js. But unfortunately, they don't play well with each other when it comes to sub commands. To accomplish what's not possible, I

  • Vilic Vane
Vilic Vane Nov 5, 2015 • 1 min read
ES6

Organize ES6 Module Imports in Your Package

ES6 brings a new way to organize modules in JavaScript. Actually by using TypeScript, we have already been using import ... from '...'; for a long time since TypeScript 1.5 alpha. But, this is what we get: And it doesn't look good, especially when you need to type the

  • Vilic Vane
Vilic Vane Sep 13, 2015 • 1 min read
Async

Write Your Own Asynchronous Task Queue with Concurrency Control in JavaScript (Part 3)

In the previous part, we've made the task queue usable. However, for better performance, we usually want multiple tasks in the queue run simultaneously. What comes to your mind first? Start Multiple Tasks Simultaneously We are dealing with an asynchronous issue, but we can still take something that runs synchronously:

  • Vilic Vane
Vilic Vane Aug 30, 2015 • 4 min read
Async

Write Your Own Asynchronous Task Queue with Concurrency Control in JavaScript (Part 2)

Continue with the previous part, in which we created a task queue that's able to execute asynchronous tasks one by one if no error occurs. Now we'll do more with it and make it really usable. Handle Errors In a task, we should be able to either synchronously throw an

  • Vilic Vane
Vilic Vane Aug 25, 2015 • 3 min read
Async

Write Your Own Asynchronous Task Queue with Concurrency Control in JavaScript (Part 1)

It should be quite simple for a qualified JavaScript programmer to write an asynchronous task queue. If you are not sure about it, you may take this tutorial a test of your skill as well. Goals Sometimes in practice we need to queue specific tasks due to varieties of reasons:

  • Vilic Vane
Vilic Vane Aug 23, 2015 • 3 min read
VS Code

VSC (Visual Studio Code) Open in Console with Git Bash under Windows

This post is out of date, please read another post for an extension which does some of the job. Let's put simple things simple and straightforward. Open file %LOCALAPPDATA%\Code\app-[version]\resources\app\client\vs\workbench\workbench.main.js. Search openTerminal and locate the function that's related to "

  • Vilic Vane
Vilic Vane Aug 23, 2015 • 1 min read
Promises

Break or Cancel the Promises Chain

Promise Promise has become an important tool for managing asynchronous operations in JavaScript. However, sometimes we would still find promises kind of annoying. Promise // Here `then` is an equivalence to `Promise.resolve().then`. .then(() => { // Start. }) .then(() => { if (wantToBreakHere) { // How? } }) .then(() => { // Something to skip. }); We may nest the

  • Vilic Vane
Vilic Vane Aug 19, 2015 • 2 min read
Office Automation

Use Office Interop under IIS

Errors related to this post: COMException (0x80010001): Call was rejected by callee. COMException (0x8001010A): The message filter indicated that the application is busy. COMException (0x800A1735): The requested member of the collection does not exist. COMException (0x800A03EC): Cannot access the file xxx. Maybe more. My recent project requires the ability to

  • Vilic Vane
Vilic Vane Aug 4, 2015 • 2 min read
Life

:)

Months ago I updated my old blog to WordPress 4.2.1, and it got into some problems and no longer function. Finally I fixed it yesterday and found it might be some incompatibility with my 5-year-old theme. Yeah, time flies. Weeks ago I started looking for a new job,

  • Vilic Vane
Vilic Vane Aug 2, 2015 • 1 min read
Vane's Life © 2022
Powered by Ghost