Skip to content

Instantly share code, notes, and snippets.

View gdiggs's full-sized avatar

Gordon Diggs gdiggs

View GitHub Profile
@gdiggs
gdiggs / index.js
Created August 5, 2016 17:56
What should I listen to? Lambda
process.env.NODE_CONFIG_DIR = "/var/task/config";
const https = require("https")
, queryString = require("querystring");
// Twilio Credentials
const accountSid = ""
, authToken = ""
, fromNumber = ""
, toNumber = "";
@gdiggs
gdiggs / gist:7565902
Created November 20, 2013 16:14
Kelly's Stuffed Mushrooms

Ingredients

  • 20ish large mushrooms (baby bellas)
  • ½ bunch chopped green onions
  • 16 oz. container of chopped clams (they have frozen ones at whole foods)
  • 2-3 cloves minced garlic
  • 1/2 cup seasoned bread crumbs
  • pinch of black pepper
  • tablespoon of dried parsley
  • some basil and oregano
-----> Ruby/Rails app detected
-----> Using Ruby version: ruby-2.1.0-rbx-2.1.1
-----> Installing dependencies using Bundler version 1.4.0.rc.1
Ruby version change detected. Clearing bundler cache.
Old: rubinius 2.0.0.m8 (1.9.3 0849828f 2013-08-02 JI) [x86_64-unknown-linux-gnu]
New: rubinius 2.1.1 (2.1.0 be67ed17 2013-10-18 JI) [x86_64-linux-gnu]
Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
Unfortunately, a fatal error has occurred. Please see the Bundler
troubleshooting documentation at http://bit.ly/bundler-issues. Thanks!
An exception occurred running vendor/bundle/rbx/2.1/bin/bundle:
@gdiggs
gdiggs / test_response_speed.rb
Created September 16, 2013 20:22
Test response speed (somewhat poorly)
#!/usr/bin/env ruby
# Given a URL, hit it a bunch of times and record the time it takes
# please dont use this for DDOS
TRIALS = 100
url = ARGV[0]
if !url
@gdiggs
gdiggs / gist:6485207
Created September 8, 2013 14:42
Spent Grain Bread

Spent Grain Bread

From http://www.michiganbeerblog.net/2011/11/spent-grain-bread.html

If you are a home brewer and are interested in how to put some of that spent grain to good use, I highly recommend trying this recipe. It took about 30 hours from start to finish, but man, was the end result worth the wait. The tender inside of the bread makes it great for sandwiches or spreads, and the sweet and malty spent grain really shines. If you are not a home brewer, find a friend that is, and go ask them for some of their spent grain. Seriously. Right now.

Note that you can freeze spent grain, and then thaw it out again before using in this recipe. It’s best to bring it up to room temperature before you start baking.

Sponge:

@gdiggs
gdiggs / gist:5518491
Created May 4, 2013 19:34
Monte Carlo Tests to Calculate Pi in Go
package main
import (
"flag"
"fmt"
"math/rand"
"sync"
"time"
)
// based on http://stackoverflow.com/a/12313690/1198757
var styleSheets = document.styleSheets,
totalStyleSheets = styleSheets.length,
maxIESelectors = 4095;
for (var j = 0; j < totalStyleSheets; j++){
var styleSheet = styleSheets[j],
rules = styleSheet.cssRules,
totalRulesInStylesheet = rules.length,
@gdiggs
gdiggs / bacon_toffee.md
Created November 11, 2012 18:29
Bacon Toffee

Bacon Toffee

Ingredients

  • 1 pound Thick Sliced Bacon
  • 1 cup Almonds, Roughly Chopped
  • 1 cup Butter
  • 1 cup Granulated Sugar
@gdiggs
gdiggs / timelapse.rb
Created July 1, 2012 04:43
ruby timelapse script
#!/usr/bin/env ruby
# Before running this, do `brew install imagesnap`
#
# Takes a photo every 30 seconds and saves it. Good for doing timelapses!
while true do
file = "~/snaps/#{Time.now.to_i}.jpg"
puts "Taking photo at #{Time.now}"
system "imagesnap -q -w 3 #{file}"
puts "waiting 30 seconds..."