Why is 2048 popular? It’s fun because:
Author Archives: lucia
China and Human Rights
A friend in America asked me about human rights and environment protection. It got me thinking.
They are worrying about whether sky should be the limit, but I rather think it’s because they have both their feet on the ground. Here people are still stuck worrying about whether the ground beneath their feet is going to crumble.
Requiring JavaScript & Stylesheets with Requirejs & Sprockets
Demo for requiring JavaScript and Stylesheets in Ruby on Rails:
$(this) and event.target
$(this)
and event.target
in on events binding: what’s the difference?
How to Read Code Beyond One’s Comprehension
A colleague of mine asked me yesterday: what’s the difference between good code and bad ones? I gave my answer without a blink: “Reusability.” The answer struck me. I didn’t realise that before I said it out loud.
One good way to improve reusability, is to consciously refine one’s code with an eye for patterns. Repetitions are worth summing up–it’s just pure fun.
Stacking Context
In IE9, if two parent elements don’t have z-index set, their children who do have z-index could jump out of the flow of z-index.
In the flow of all DOM elements, there is something that decides the order of appearance among each other: the stacking context. And its behaviour is somewhat odd in some cases.
Those Who Compile Into JavaScript
I wondered what it would be like to have my front-end workflow in Ruby, or Common Lisp. What about all the libraries that could have been easily bowered and required in JavaScript? Could existing libraries somehow fit into the picture, or should there be counterparts taking their places? What about CoffeeScript, how does it work?
After some research, the list of answers I got: