View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
View firebase-rule-pretty-printer.js
// This is just a toy. I used this to experient before adding more advanced functionality into Targaryen.
const esprima = require('esprima');
var expr = "data.val() == null && auth != null && (auth.isWorker == true || (newData.parent().child('chatType').val() == 'oneToOne' && $chatID.contains(auth.uid) == true || newData.parent().child('chatType').val() == 'group' && newData.parent().child('users').val() != null && newData.parent().child('users').child(auth.uid).val() != null || newData.parent().child('chatType').val() == 'org' && (auth.officialCounselorAt == null && $chatID.contains(auth.uid) == true || newData.parent().child('orgID').val() != null && auth.officialCounselorAt != null && auth.officialCounselorAt[newData.parent().child('orgID').val() + ''] == true))) || data.val() != null && newData.val() != null && auth != null && auth.isWorker == true || data.val() != null && newData.val() == null && auth != null && auth.isWorker == true";
var tree = esprima.parse(expr);
// BinaryExpression
// CallExpres

Mac OS X - Wallpaper Changer

Swift code to change the Wallpaper for all screens. Currently, it changes only the current spaces' wallpaper. I'm working on a version to change in all spaces.

Usage: WallpaperChanger "/Users/username/SomeFolder/SomePicture.jpg"

View gist:f2a03810fe9bce77888d
/*jshint node:true*/
var http = require('http');
var fs = require('fs');
var url = require('url');
var querystring = require('querystring');
var head = fs.readFileSync('head.html','UTF-8');
// <meta charset="utf-8">
View ForceCaseSensitivityPlugin.js
var fs = require('fs');
var path = require('path');
var _ = require('lodash');
module.exports = function ForceCaseSensitivityPlugin() {
this.plugin('normal-module-factory', function(nmf) {
nmf.plugin('after-resolve', function(data, done) {
var parentDir = path.dirname(data.resource);
var resourceName = path.basename(data.resource);
fs.readdir(parentDir, function(err, files) {
View sass_get_asset_url.rb
require 'json'
module Sass::Script::Functions
def get_md5s
md5sfile = File.join Dir.pwd, 'tmp/browser/cache/md5.json'
return JSON.parse(
View get_asset_url.js
var fs = require('fs');
var path = require('path');
var md5itCfg = require('../grunt/config/cl_md5it');
module.exports = function(babel) {
var t = babel.types;
var md5sFile = md5itCfg.options.manifestFile;
var md5s, cache = {};
View gist:d85dd4bc8b3b114f4363

While I was experimenting with animation, I had to make a few basic prototypes for a layout system and see how they intertwine. Here's the API in conjunction with React:

var MyComp = React.createClass({
  registerLayoutValues: function() {
    return {
      self: {
        width: 30,
        left: (get('parent', 'width') - get('self', 'width')) / 2 // Center.
View gist:d9afb14d1a5ba760b194

Interesting part (unmounting & API) is at the end if you're not interested in the rest =).

Stress Tests

This animation proposal is just an attempt. In case it doesn't work out, I've gathered a few examples that can test the power of a future animation system.

  1. Parent is an infinitely spinning ball, and has a child ball that is also spinning. Clicking on the parent causes child to reverse spinning direction. This tests the ability of the animation system to compose animation, not in the sense of applying multiple interpolations to one or more variables passed onto the child (this should be trivial), but in the sense that the parent's constantly updating at the same time as the child, and has to ensure that it passes the animation commands correctly to it. This also tests that we can still intercept these animations (the clicking) and immediately change their configuration instead of queueing them.

  2. Typing letters and let them fly in concurrently. This tests concurrency, coordination of an array of ch