Skip to content

Instantly share code, notes, and snippets.

View thgaskell's full-sized avatar
🤖

Tony Gaskell thgaskell

🤖
View GitHub Profile
@thgaskell
thgaskell / ES5-Number.js
Created May 4, 2015 06:27
Private variables with TypeScript + WeakMaps
var Number;
(function (Number_1) {
var map = new WeakMap();
var internal = function (object) {
if (!map.has(object))
map.set(object, {});
return map.get(object);
};
var Number = (function () {
function Number(x) {
@thgaskell
thgaskell / README.md
Created February 22, 2015 23:57
Sequelize Associations

File Structure:

  • seed_database.js
  • config.json
  • models/
    • index.js
    • User.js
    • UserType.js

Make sure that the SQL configs are in config.json.

@thgaskell
thgaskell / Gulpfile.js
Created March 25, 2014 15:02
Creates a mini development environment for serving static content.
var gulp = require('gulp'),
gutil = require('gulp-util');
var paths = {
css: 'assets/css/**/*.css',
html: 'assets/html/**/*.html',
js: 'assets/js/**/*.js',
img: 'assets/images/**/*.{png,jpg,jpeg,gif}'
};
@thgaskell
thgaskell / Class.js
Created November 13, 2013 02:42
Mimic Java classes using closures and object properties.
var Class =
// Create a closure with an Immediately-Invoked Function Expression (IIFE)
(function () {
(function _init() {
// Similar to a static initializer in Java
// This is optional, but it prevents polluting the Class scope.
})();
// Private static variable
var _static;