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 (global) { | |
'use strict'; | |
var Validator = function Validator() { | |
this.schemas = { | |
text: { | |
maxLength: function (val, prop) { | |
return { | |
success: val.length <= prop.maxLength, | |
msg: 'Value exceeds maximum length: ' + prop.maxLength + '.' |
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 stringUtil = (function(global)) { | |
// prototype modifiers | |
if (typeof String.prototype.startsWith !== 'function') { | |
String.prototype.startsWith = function(str) { | |
return this.slice(0, str.length) === str; | |
}; | |
} | |
if (typeof String.prototype.endsWith !== 'function') { |
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
0 info it worked if it ends with ok | |
1 verbose cli [ 'node', | |
1 verbose cli '/usr/local/bin/npm', | |
1 verbose cli 'install', | |
1 verbose cli 'https://api.github.com/repos/kiplic/tardis/tarball/master' ] | |
2 info using npm@2.1.8 | |
3 info using node@v0.10.33 | |
4 verbose node symlink /usr/local/bin/node | |
5 silly cache add args [ 'https://api.github.com/repos/kiplic/tardis/tarball/master', | |
5 silly cache add null ] |
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
/** @jsx React.DOM */ | |
var itemList = [ | |
'Apples', | |
'Pie', | |
'Brocooli', | |
'Chicken', | |
'Duck', | |
'Eggs', | |
'Fish', |
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 Table = React.createClass({ | |
getInitialState: function () { | |
var data = []; | |
for (var r = 0; r < this.props.rows; r++) { | |
data[r] = []; | |
for (var c = 0; c < this.props.columns; c++) { | |
data[r][c] = 0; | |
} | |
} | |
return { |
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 mongoose = require('mongoose'), | |
Schema = mongoose.Schema; | |
var fields = { | |
// fields for model | |
name: String | |
}; | |
var ModelSchema = new Schema(fields); |
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 http = require('http'); | |
var urls = process.argv.slice(2); | |
var results = []; | |
var done = 0; | |
function printResults() { | |
for (var i = 0; i < 3; i++) console.log(results[i]); | |
} |
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
!#/usr/bin/python | |
import sys | |
file = open(sys.argv[1]) | |
lst = [] | |
for line in file: | |
lst.append(line.strip().split()) | |
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
brew tap homebrew/completions | |
brew install django-completion | |
# resource your profile | |
source ~/.bashrc |
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 initialState() { | |
return []; | |
} | |
function selectReducer(state = initialState(), action) { | |
switch (action.type) { | |
case SELECT_OPTION: | |
return state.map(option => | |
option.id === action.id | |
? { ...option, selected: true } |
OlderNewer