Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
KNEE DEEP IN THE HOOPLA

Josh Holbrook jfhbrook

💭
KNEE DEEP IN THE HOOPLA
View GitHub Profile
View gist:7d139f9f1bfa1b2089759d0f986609af
dimensions = message['Trigger']['Dimensions']
for dimension in dimensions:
if dimension['name'] == 'InstanceId':
instance_id = dimension['value']
break
View index.js
#!/usr/bin/env nodejs
class REST {
constructor() {
return Promise.try(() => this.connectMySQL())
.then((connection) => this.otherThing())
.then((whateverOtherThingReturns) => this.etc())
;
connectMySQL() {
View promiseHandle.js
var promiseDat = require('./promiseTest.js');
console.log(promiseDat);
promiseDat().then((dat)=>{
console.log(dat);
return dat[0];
})
View Issue.js
import db from '../db';
export default class Issue {
constructor(data) {
...
}
static insertNewIssue(data) {
return db('issue').insert({
agency_id: data.agencyId,
View itoa.js
var dict = ["a", "s", "d", "f"]
function iota(n) {
var retstr = ""
var digit
while (n) {
digit = dict[(n % (dict.length + 1)) - 1]
retstr = digit + retstr
View async-madness.js
// npm install cli-prompt
var prompt = require('cli-prompt');
// npm install async
var async = require('async');
var fs = require('fs');
var files = [
{path: './foo', src: 'foo'},
{path: './bar', src: 'bar'}
];
View by-state.js
var fs = require('fs');
var dat = fs.readFileSync('./rows.dat', 'utf8');
var rows = dat
.split('\n')
.filter(function (l) {
return l.length;
}).map(function (l) {
eval('var r = ' + l);
View gist:6171070
var crypt = require('crypto');
var fs = require('fs');
var options = require('./options.json');
var client = net.connect(options)
var filename = './my-program.exe';
var header = {
sentdate: new Date(),
@jfhbrook
jfhbrook / index.js
Created Jul 30, 2013 — forked from substack/index.js
requirebin sketch
View index.js
var master = new (webkitAudioContext || AudioContext)
var util = require('util')
var jsynth = require('jsynth')
var tune = require('tune')
var teoria = require('teoria')
var tones = []
var notes = ['first', 'second', 'third', 'fourth', 'fifth']
notes.map(function(i) {
@jfhbrook
jfhbrook / word_search.js
Last active Dec 19, 2015 — forked from naomik/word_search.js
"Hello cruel world bears!" "That's iiiit!!!" "Thanks Pat Sajak!!!!"
View word_search.js
// possible words
var words = ["lazy", "crackers", "hello", "cruel", "world", "bears", "need", "not", "apply"];
// characters
var puzzle = " \
r b f x w \
h e l l o \
o a h c r \
c r u e l \
v s u f d \
You can’t perform that action at this time.