Skip to content

Instantly share code, notes, and snippets.

@adamauckland
adamauckland / gist:2c853dafbcf49626428d
Created May 7, 2014 17:10
Example of chaining deferred promises
//
// Demonstration of chaining deferred promises together
//
var Q = require('q');
function firstFunction () {
var deferred = Q.defer();
/**
* @description: Creates the styling for the social navigation
*
* @author: kaelifa
* @version: 0.1
* @date: 2013-02-02
*
*
* @example:
* <nav class="navSocial">
/**
* An asynchronous loop implementation
*
* @param {array} inputArray
* @param {function} loopFunction: Function you want to call on each item.
* @example
*
var loopArray = [];
loopArray.push({ name: 'apple' });
@adamauckland
adamauckland / data.json
Created May 26, 2016 21:22
[long, lat], datetime
[
[
[
-1.461718191699953,
50.92572792453119
],
"2016-04-26T08:37:51.101Z"
],
[
[
{
"_id":"76fb08340b4bef661da571f49e098b16",
"_rev":"1-241e3735369d60bf123471b4287c7329",
"folders":[
],
"status":"new",
"datetime":"2017-01-27T18:46:12.397Z",
"user":"76fb08340b4bef661da571f49e0945ec",
"message":"Hello. Posted as me",
@adamauckland
adamauckland / index.js
Created March 21, 2017 07:02
Testing renaming classes
// Requires Node V8
//
// Put this script in a directory, then do:
//
// $ npm init
// $ npm install cornerstonelabs-semantic-logging --save
// $ node index.js --harmony
//
//
@adamauckland
adamauckland / test-rename.js
Last active March 21, 2017 08:28
Testing renaming classes
class OriginalClass {
constructor () {
console.log(this);
}
}
var originalClass = new OriginalClass();
// outputs:
//
[
{
"path": "/todo/list",
"handler": "ListHandler",
"verb": "get"
},
{
"path": "/todo/list/:id",
"handler": "DetailHandler",
"verb": "get"
var stage = new createjs.Stage("canvas");
createjs.Ticker.addEventListener("tick", tick);
function shapey(x, y, angule) {
var shape2 = new createjs.Shape().set({x:x, y:y});
shape2.graphics.s("#fdd").ss(20, "round");
stage.addChild(shape2);
var startAngle = -90 * Math.PI/180;
var endAngle = 270 * Math.PI/180;;
@adamauckland
adamauckland / create-njk.py
Created September 28, 2018 09:12
Create stub njk files from a directory structure
#
# Put this file in the root of the directory your JSON files are in and run it
#
# $ python create-njk.py
#
# The stub content is at line 27. It supports adding more lines. Percentages must be doubled to escape them.
import os
import os.path