Skip to content

Instantly share code, notes, and snippets.

@shaohua
shaohua / index.html
Created September 1, 2013 19:20 — forked from bunkat/index.html
<html>
<head>
<title>Swimlane using d3.js</title>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.v2.js"></script>
<script type="text/javascript" src="randomData.js"></script>
<style>
.chart {
shape-rendering: crispEdges;
}
;(function() {
var api = {},
$response = $('#response');
$('#ajaxForm').on('submit', function(e) {
e.preventDefault();
var search = $('#title').val();
$response.empty().addClass('loading');
if (!api[search]) {
api[search] = $.ajax({
(function () {
App.Views.PopoverView = Backbone.View.extend({
initialize: function (options) {
_.bindAll(this, "render", "setContent", "show", "hide", "toggle", "destroy", "remove");
this.offsetTop = 30;
this.offsetLeft = 0;
@shaohua
shaohua / gist:6010872
Last active December 19, 2015 20:08
Bookmarks
http://7enn.com/2011/03/13/running-rake-automatically-when-rb-file-changes/
https://brendaneich.com/2012/10/harmony-of-dreams-come-true/
http://dailyjs.com/2012/10/15/preparing-for-esnext/
http://wiki.ecmascript.org/doku.php?id=harmony:specification_drafts
http://www.technicalypto.com/2010/04/trie-in-java.html
http://openmymind.net/mongodb.pdf
http://www.public.asu.edu/~fmorstat/paperpdfs/icwsm2013.pdf
http://www.10gen.com/presentations/mongodb-melbourne-2012/schema-design-example
http://gun.io/blog/Building-Backbone.js-apps-with-Backlift-part-2-Collections-and-Forms/
@shaohua
shaohua / gist:6005862
Created July 16, 2013 04:51
wip for ruby
def add(*numbers)
numbers.inject(0) {|sum, number| sum += number}
end
def subtract(*numbers)
numbers.inject {|result, number| result -= number}
end
def calculate(*args)
options = {'add'=>true}
# Setup dir and repo
mkdir underscore-string
cd underscore-string
git init
# Make some files we'll need
touch README.md package.js smart.json
# Add the submodule and checkout the desired branch
git submodule add git://github.com/epeli/underscore.string.git lib/underscore.string
#!/usr/bin/env python
from __future__ import with_statement # needed for python 2.5
from fabric.api import *
from fabric.contrib.console import confirm
from fabric.contrib import files
USAGE = """
================================================================
NOTE:
using this fabfile expects that you have the python utility