Skip to content

Instantly share code, notes, and snippets.

/**
* Annotated Gruntfile.
* This builds a Backbone/Marionette application using Dust.js (Linkedin fork) as a
* templating system, as well as some helpers from Foundation, with Browserify.
* It also configures a watcher and static server with live reload.
*/
module.exports = function (grunt) {
// This automatically loads grunt tasks from node_modules
require("load-grunt-tasks")(grunt);
@shaohua
shaohua / gist:9746058
Last active October 18, 2017 15:32
xhtml-mathml.xsl
<!--
$Id: xhtml-mathml.xsl,v 1.4 2007/05/11 00:58:31 David Carlisle Exp $
Copyright David Carlisle 2007.
Use and distribution of this code are permitted under the terms of the <a
href="http://www.w3.org/Consortium/Legal/copyright-software-19980720"
>W3C Software Notice and License</a>.
-->

Docker Cheat Sheet

Why

Why Should I Care (For Developers)

"Docker interests me because it allows simple environment isolation and repeatability. I can create a run-time environment once, package it up, then run it again on any other machine. Furthermore, everything that runs in that environment is isolated from the underlying host (much like a virtual machine). And best of all, everything is fast and simple."

TL;DR, I just want a dev environment

@shaohua
shaohua / gist:8412587
Created January 14, 2014 03:34
keen showLineChart
showLineChart: function(){
Keen.onChartsReady(function(){
//Find the amount of money made from purchases each day for the last 7 days
//only count the users that that are over 21 years old.
var mySeries = new Keen.Series("purchases", {
analysisType: "sum",
targetProperty: "total_price",
timeframe: "previous_7_days",
interval: "daily"
@shaohua
shaohua / gist:7441998
Created November 13, 2013 01:25
get_gadget.js
define(["gadget", "cdn.jquery"],function(Gadget, $){
var getOptions = function(){
/* Versal's options.player is an extension
* of Backbone.Events
*/
var player = {};
_.extend(player, Backbone.Events);
/* Gadget options.config is a Backbone model */
@shaohua
shaohua / gist:7441921
Last active December 28, 2015 04:19
package.json
{
"name": "test",
"version": "0.0.1",
"devDependencies": {
"mocha": "*",
"chai": "*",
"requirejs": "~2.1.9"
}
}
@shaohua
shaohua / gist:7441902
Created November 13, 2013 01:14
TestRunner.js
define([], function() {
/*
There may be times when you do want to reference a script directly and not conform to the "baseUrl + paths" rules for finding it. If a module ID has one of the following characterstics, the ID will not be passed through the "baseUrl + paths" configuration, and just be treated like a regular URL that is relative to the document:
Ends in ".js".
Starts with a "/".
Contains an URL protocol, like "http:" or "https:".
*/
/* app specs here */
@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>
@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();
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*