Skip to content

Instantly share code, notes, and snippets.

@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: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: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: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"

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: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>.
-->
/**
* 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);
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-field/core-field.html">
<link rel="import" href="../core-icon/core-icon.html">
<link rel="import" href="../core-input/core-input.html">
<link rel="import" href="../core-icons/core-icons.html">
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-field/core-field.html">
<link rel="import" href="../core-icon/core-icon.html">
<link rel="import" href="../core-input/core-input.html">
<link rel="import" href="../core-icons/core-icons.html">
<!DOCTYPE html>
<html>
<head>
<title>Empty gadget</title>
</head>
<body>
Behold your gadget
<iframe src="https://app.box.com/embed_widget/s/rytekckemew26i37kjvd?view=list&sort=name&direction=ASC&theme=blue" width="500" height="400" frameborder="0"allowfullscreen webkitallowfullscreen msallowfullscreen></iframe>
<script type="text/javascript">
window.addEventListener("message", function(event){