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
/** | |
* RuleMatcher is a helper class to define groups of rules. It provides methods | |
* to execute a particular criteria against one rule, a set of rules, or all | |
* rules. | |
* | |
* @class | |
*/ | |
function RuleMatcher(config) { | |
if (!(this instanceof RuleMatcher)) { | |
return new RuleMatcher(config); |
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
Bitloader.Logger.default.enable(); | |
Bitloader.Logger.default.stream = { | |
write: function(buffer) { | |
console.log(buffer); | |
} | |
}; | |
Bitloader.Logger.default.serialize = function(packet) { | |
return JSON.stringify({ |
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
//https://github.com/MiguelCastillo/bit-loader | |
//https://github.com/MiguelCastillo/bit-imports | |
/* jshint -W098 */ | |
var require = (function() { | |
/* jshint +W098 */ | |
var importer = bitimports.config({ | |
"baseUrl": "../", | |
"paths": { | |
"chai": "../node_modules/chai/chai", |
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
import React from 'react'; | |
class Login extends React.Component { | |
render() { | |
return ( | |
<div className='Login'> | |
<input type='text' ref='username'></input><input type='password' ref='password'></input> | |
<button onClick={this.login}>Please Login</button> | |
</div> | |
); |
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
{ | |
"insertHintOnTab": true | |
} |
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
var browserify = require('browserify'); | |
var gulp = require('gulp'); | |
var source = require('vinyl-source-stream'); | |
var through = require('through'); | |
var libs = ['jquery', 'bootstrap']; | |
gulp.task('app-bundle', function() { | |
var appBundler = browserify(['./app.js']); | |
libs.forEach(function(lib) { |
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
var promises = [promise1, promise2, promise3]; | |
// Now you can actually call a cancel interface without affecting the state of the promises. | |
var cancelable = cancelableSenquence(promises); | |
function cancelableSequence(promises) { | |
var cancelled = false; | |
var cancelable = promises.reduce(function(prev, curr) { |
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
/** | |
* spromise Copyright (c) 2014 Miguel Castillo. | |
* Licensed under MIT | |
*/ | |
var define, require; | |
(function() { | |
var root = this, | |
cache = {}; |
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
/** | |
* Task manager to handle queuing up async tasks in an optimal manner | |
*/ | |
var TaskManager = { | |
_asyncQueue: [], | |
asyncTask: function(task) { | |
if (TaskManager._asyncQueue.push(task) === 1) { | |
async(TaskManager.taskRunner(TaskManager._asyncQueue)); | |
} | |
}, |
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 printStack() { | |
try { | |
throw new TypeError(""); | |
} | |
catch(ex) { | |
console.log(ex.stack); | |
} | |
} |