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
body { | |
font-family: Helvetica, arial, sans-serif; | |
font-size: 14px; | |
line-height: 1.6; | |
padding-top: 10px; | |
padding-bottom: 10px; | |
background-color: white; | |
padding: 30px; } | |
body > *:first-child { |
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
// Includes functions for exporting active sheet or all sheets as JSON object (also Python object syntax compatible). | |
// Tweak the makePrettyJSON_ function to customize what kind of JSON to export. | |
var FORMAT_ONELINE = 'One-line'; | |
var FORMAT_MULTILINE = 'Multi-line'; | |
var FORMAT_PRETTY = 'Pretty'; | |
var LANGUAGE_JS = 'JavaScript'; | |
var LANGUAGE_PYTHON = 'Python'; |
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 async = require('async'), | |
async.series([ | |
function(callback) { | |
setTimeout(function() { | |
console.log('f1'); | |
callback(null, 'one'); | |
}, 800); | |
}, | |
function(callback) { |
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
// match ip address but not internal 10. | |
"dkdl sld dj d 110.2.33.7 asjd ".match(/[^\d](?!10\.)\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/); |
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
_.mixin({ | |
pickStartsWith : function(obj,beginStr) { | |
if ( _.isArray(obj) || ! _.isObject(obj) ) throw new TypeError("pickStartsWith must be called on an object"); | |
return _.pick(obj, _.filter(_.keys(obj), function(el, index) { return el.indexOf(beginStr) == 0; })); | |
}, | |
pickMatch : function(obj,regex) { | |
if ( _.isArray(obj) || ! _.isObject(obj) ) throw new TypeError("pickBeginsWith must be called on an object"); | |
return _.pick(obj, _.filter(_.keys(obj), function(el, index) { return el.match(regex) != null; })); | |
}, | |
keyReplace : function(obj,regex, replace) { |
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
{ | |
"uri" : "https://www.google.com/search", | |
"qs" : { "q" : "Example Search" }, | |
"method" : "GET", | |
"headers" : { | |
"User-Agent" : "Mozilla/5.0 (iPad; CPU OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5355d Safari/8536.25" | |
}, | |
"strictSSL" : false, | |
"timeout" : 20000, | |
"followRedirect" : false |
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 fs = require('fs'); | |
var _ = require('lodash'); | |
var defs = fs.readFileSync('servicedefs.json', {encoding:'utf8'}); | |
var defsJson = JSON.parse(defs); | |
var indexedDefs = _.indexBy(defsJson, 'id'); | |
_.each(indexedDefs, function(def, index) { | |
var current = def; | |
while ( _.has(def, 'under') ) { |
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 express = require('express') | |
, http = require('http') | |
, bodyParser = require('body-parser') | |
, _ = require('underscore') | |
, cookieParser = require('cookie-parser'); | |
var app = express(); | |
/* configure express */ | |
app.set('port', process.env.PORT || 3000); |
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 _ = require('lodash'); | |
var obj1 = {foo:'bar',baz:'bang', arr:[1,3,5,7], objecter : { 'connor' : 2, 'sky':'toot', 'new':'dude' } }; | |
var obj2 = {foo:'bar',baz:'bang', arr:[2,4,6,8], newz:1, objecter : { 'sky' : 'mills'} }; | |
merge(obj1,obj2); | |
merge(null,2); | |
merge(4,6); | |
console.log(obj1); |
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 request2Curl(options) { | |
var tokens = ['curl', '-v', '-k', '-ssl3']; | |
if ( _.has(options, 'auth') ) { | |
if ( _.has(options.auth, 'user') ) { | |
tokens.push('--user', "'" + options.auth.user + ":" + options.auth.pass + "'"); | |
} | |
} | |
var isPost = _.has(options, 'method') && options.method.toLowerCase() == 'post'; |
OlderNewer