Skip to content

Instantly share code, notes, and snippets.

View mwheeler's full-sized avatar

Mitchell Wheeler mwheeler

  • Melbourne, Australia
View GitHub Profile
@mwheeler
mwheeler / Promise.all example
Created March 12, 2015 05:39
Promise.all example
var Promise = require('bluebird');
Promise.longStackTraces();
var A = new Promise(function(pass, fail)
{
console.log("A started");
setTimeout(function()
{
console.log("A finished");
pass();
@mwheeler
mwheeler / TypeScriptImportParser
Created January 7, 2014 03:54
Example of parsing require()'s in typescript 0.9.5
var fs = require('fs');
var path = require('path');
// dodgy arg parsing
var input = process.argv[2];
// import typescript
var TypeScript = (function(){
var sandbox = {
__filename: __filename,
@mwheeler
mwheeler / TypeScriptASTSample.js
Last active January 2, 2016 11:09
A quick example for walking the raw AST in typescript 0.9.5.
var fs = require('fs');
var path = require('path');
// Load the typescript module
var TypeScript = (function(){
var sandbox = {
__filename: __filename,
__dirname: __dirname,
global: global,
process: process,
@mwheeler
mwheeler / ActionBarExample.java
Last active December 15, 2015 02:09
cordova-android-actionbar ActionBar Sherlock example
// Copyright (C) 2013 Polychrom Pty Ltd
//
// This program is licensed under the 3-clause "Modified" BSD license,
// see LICENSE file for full definition.
package com.polychrom.examples;
import java.util.concurrent.ExecutorService;
import android.app.Activity;
@mwheeler
mwheeler / doubletap.js
Created November 14, 2012 02:04
Double tap jQuery plugin
var DoubleTap =
{
touchStart: function(event)
{
this.touched = true;
},
touchEnd: function(event)
{
if(!this.touched)
@mwheeler
mwheeler / subdoc_test.js
Created September 30, 2012 04:25
Mongoose weirdness
var mongoose = require('mongoose');
mongoose.connect("localhost", "subdoc_test");
var SubDocSchema = new mongoose.Schema({ foo: String, bar: String });
var mapFrom = function(x) { x.foo = x.abc; x.bar = x.xyz; delete x.abc; delete x.xyz; return x; }
var TestSchema = new mongoose.Schema({
values:
{