View gist:18676187c0b8481793e3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
React JS Wisconsin | |
_ | |
_| `...,, Scansin | |
( \/| | |
| / | |
\ / | |
| JS | | |
(______| |
OlderNewer