Command-t.vim crash on yosemite

The bug

Today I updraged my mac osx to 10.10 yosemite,
However, the command-t.vim plugin does not work correctly with new os.

I saw the command-t.vim could not load the C extension message from vim.

Read More...

Learn jQuery from jqLite

JQuery

Jquery is a great library, it makes manipulating DOM element and browser really simple and easy.
As a web developer, jQuery is our day to day tool. However, sometimes it just too convenience that
we forget how to make web page without it. It is important to go back to see how jQuery handle and wrap
the DOM api and provide the simple interface for us.

JQLite

JQLite

Angular.js comes with a simple compatible implementation of jQuery, called JQLite.
JQLite is used internally for angular.element if user doesn’t include jQuery, as a
replacement for jQuery. It only have 1000 lines of code with lots comments,
So it’s a good starting point to understand how jQuery works.

Read More...

Understand node stream (what I learned when fixing Aws sdk bug)

Node.js stream

Node.js provides asynchronous I/O base on event loop.
When reading and writing from filesystem or sending http request,
Node.js can process other events when waiting for response, which we called it non-blocking I/O.
Stream is an extend of this concept, it provides an event base I/O interface to
save memory buffers and bandwidth.

Read More...

What I Talk About When I Talk About Pairing

Pair programming, I used to heard a lot about it.
Some said, it is fun.
Some said, it produce good and clean code.
Some said, you can learn from your pair everyday.
Therefore, When I have chance to join a pair programming shop. I took the offer without any hestitation.

So after 7 months of pair programming. I thinks it’s a good time to talk about it.

Read More...

Understand chef lwrp (Heavy version)

Recently I am mainly working on devops things, including system admin and chef.
We are refactoring our old chef recipes into a more modulize shape with tests,
So I think it’s a good time to share some experience in this refactor!

Resource and Provider in Chef

In chef, we use resource to describe the state of our system.
And cookbook is a series of resources that describe the server state.

Read More...

Test driven server configuration with chef

Recently I am working on Devops things, including server, network,deployment and chef scripts. In the Devops team, we are working hard on refactoringour old chef recipes into more clean and modularize cookbooks.So I thin

Read More...

Announcing Code-Warrior

Recently I am preparing the interview with some companies in West Coast.
One of the problem I have during the preparation, which is because I am a vim user,
It is uncomfortable to practice algorithm questions on TopCoder, so I think it would be great if I have a npm tool that can
download algorithm problems and provide some skeleton test case for practice.
Therefore I created Code-Warrior

Read More...

Bacon.js for dummies

Bacon.js is an FRP module for events on javascript. Which can transform
your event listener/handler to a functional event stream. After servey a few blogs and example project,
I found it is a really interesting concept and can make event handling speghetti code into clear functional logics.

Event stream

First, what is event stream?
Actually it is nothing special, it is just an event listener that listen to specific event.

For example,

$("#clickme").on('click', function(event){ alert(event.target)})

Can transfer to event stream by Bacon.js’s asEventStream helper:

clicked = $("#clickme").asEventStream('click')

And add handler to event stream, listen to click event:

clicked.onValue(function(event){ alert(event.target) })

Read More...

express bigpipe experiment

Bigpipe

Bigpipe is an unique frontend technique used by Facebook to increase their page rendering speed.

When I read the article talk about bigpipe on facebook, I was pretty shocked about how facebook implements those unique ideas to
increase their page rendering speed.

Recently I am using node.js for web development, I think the async structure of node is a perfect environment to use this technique, so I wrote a small experiments app with express:

Read More...

Understand event loops

Event loop is the core feature in node.js,
and is also the reason why it is better on handling requests and realtime communication like long polling.

The Obstacle of IO

The reason is on this is because the I/O is expensive:

Read More...