Skip to content

Instantly share code, notes, and snippets.

View jaketrent's full-sized avatar
🎹
Coding a power ballad

Jake Trent jaketrent

🎹
Coding a power ballad
View GitHub Profile
@jaketrent
jaketrent / simple-promise-retry.js
Created January 14, 2016 17:36 — forked from briancavalier/simple-promise-retry.js
A few general patterns for retries using promises
function keepTrying(otherArgs, promise) {
promise = promise||new Promise();
// try doing the important thing
if(success) {
promise.resolve(result);
} else {
setTimeout(function() {
keepTrying(otherArgs, promise);

When a beginner asks you "when do I use semi-colons?" would you rather say this?

// what people who say "use semicolons!!" say
class Foo {
  prop = {
  }; // yes
#!/usr/bin/env ruby
verbose = ARGV[0] == '-v'
def colorize(text, color_code)
"\e[#{color_code}m#{text}\e[0m"
end
def red(text); colorize(text, 31); end
def green(text); colorize(text, 32); end
@jaketrent
jaketrent / dynamo.rb
Last active August 29, 2015 14:01 — forked from jwillesen/gist:7552a515daff571bf407
Ruby AWS sdk - Dynamo put and get
require 'aws-sdk'
require 'securerandom'
require 'pp'
$dynamo = AWS::DynamoDB.new(
access_key_id: 'blah',
secret_access_key: 'blah/blah/blah',
)
$table = $dynamo.tables['some-table-name-here']