Skip to content

Instantly share code, notes, and snippets.

#!/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
# 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
@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}
@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/
(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;
;(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({
@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;
}
This is a method to using your Ubuntu 12.04 server without the Unity desktop on a very fast remote desktop program. This is by far the best method to managing your Ubuntu server if you like GUI.
apt-get install --no-install-recommends ubuntu-desktop
apt-get --yes purge unity unity-2d unity-2d-places unity-2d-panel unity-2d-spread
apt-get --yes purge unity-asset-pool unity-services unity-lens-* unity-scope-*
apt-get --yes purge liboverlay-scrollbar*
apt-get --yes purge appmenu-gtk appmenu-gtk3 appmenu-qt
apt-get --yes purge firefox-globalmenu thunderbird-globalmenu
apt-get --yes purge unity-2d-common unity-common
apt-get --yes purge libunity-misc4 libunity-core-5*
@shaohua
shaohua / gist:7296333
Created November 4, 2013 00:17
backbone delegateevents
events: {
'click body': 'onClickBody'
},
onClickBody: function(){
console.log('click');
},
render: function(){
this.template();
@shaohua
shaohua / gist:7441895
Created November 13, 2013 01:13
TestRunner.html
<html>
<head>
<title> Tests </title>
<link rel="stylesheet" href="./test/node_modules/mocha/mocha.css" />
</head>
<body>
<div id="mocha"></div>
<script src="./test/node_modules/mocha/mocha.js"></script>
<script src="./test/node_modules/chai/chai.js"></script>
<script>