Skip to content

Instantly share code, notes, and snippets.

Avatar

Ezekiel Chentnik ezekielchentnik

View GitHub Profile
View gist:18676187c0b8481793e3
// see blog post: http://www.hiddentao.com/archives/2013/07/08/generate-overridable-getters-and-setters-in-javascript/
Function.prototype.generateProperty = function(name, options) {
// internal member variable name
var privateName = '__' + name;
options = options || {};
options.get = ('undefined' === typeof options.get ? true : options.get );
options.set = ('undefined' === typeof options.set ? true : options.set );
// pre-initialise the internal variable?
View attrify
function attrify(config) {
var properties = {};
for (var prop in config) {
if (prop && config.hasOwnProperty(prop)) {
properties[prop] = (function(name) {
return function() {
if (!arguments.length) {
return config[name];
}
View redux-history.js
const UPDATE_LOCATION = 'UPDATE_LOCATION';
import { createLocation } from 'history';
var initialState = createLocation();
export function locationReducer(state = initialState, action) {
//needs support for Immutable.js
if (action.type === UPDATE_LOCATION) {//issues w/deep merge, query ??
return Object.assign({}, state, action.payload)
View buildAll.js
/**
* Runs an ordered set of commands within each of the build directories.
*/
import fs from 'fs'
import path from 'path'
import { spawnSync } from 'child_process'
var exampleDirs = fs.readdirSync(__dirname).filter((file) => {
return fs.statSync(path.join(__dirname, file)).isDirectory()
View gist:11f33eb8c07ce054f9c7
/*
React JS Wisconsin
_
_| `...,, Scansin
( \/|
| /
\ /
| JS |
(______|