Skip to content

Instantly share code, notes, and snippets.

Jake Lodwick jakelodwick

Block or report user

Report or block jakelodwick

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
jakelodwick / integration_request.vtl
Created Mar 12, 2016
AWS API Gateway - Integration Request - Mapping Template
View integration_request.vtl
Via <>.
This mapping template formats most information that API Gateway receives, for easy use in a Lambda function (or whatever).
Not sure why the same effect isn't achieved with the "Input passthrough" option!
"method": "$context.httpMethod",
"body" : $input.json('$'),
"headers": {
#foreach($param in $input.params().header.keySet())
jakelodwick /
Created Dec 21, 2015
load multiple files via XHR, then run a callback
loadSamples: (urls, callback) ->
loaded = []
requests = []
decode = (_raw) =>
@audio.decodeAudioData _raw, (sample) ->
loaded.push sample
callback(loaded) if loaded.length is urls.length
jakelodwick /
Created Oct 26, 2015
redirect from http to https
if location.protocol is "http:"
window.location = window.location.toString().replace("http:", "https:")

Setting up Caffe for Running Deepdream on OS X


Use Brew

Install brew and pip (sudo easy_install pip)

brew update
brew install homebrew/science/openblas
jakelodwick / vcenter.css
Created Dec 9, 2014
vertically center in CSS
View vcenter.css
.vcenter {
display: inline-block;
position: relative;
top: 50%;
transform: translateY(-50%);
jakelodwick /
Created Sep 9, 2014
Getting Heroku environment variables into local repo
heroku plugins:install git://
heroku config:pull --overwrite --interactive
jakelodwick / phttp
Created Aug 18, 2014
Start webserver in current directory & open browser window to it
View phttp
# run these two commands:
open http://localhost:8000/
python -m SimpleHTTPServer
# I put the following in ~/.profile (OS X) so it runs every time I open a terminal window:
alias phttp="open http://localhost:8000/; python -m SimpleHTTPServer"
jakelodwick /
Created Aug 17, 2014
Get last element of array
# last element of array,
# alternative to `my_array[my_array.length - 1]`
# via
unless Array::last
Array::last = ->
this[@length - 1]
# pretty-print JSON
ppjson = (obj) ->
console.log JSON.stringify obj, undefined, 2
jakelodwick / gist:4b6e1f938403a1c92cf5
Created Aug 17, 2014
CoffeeScript in Sinatra apps
View gist:4b6e1f938403a1c92cf5
#put this in your Gemfile:
gem "rack-coffee"
#(don't forget to run `bundle` on the command line)
#put this in your Sinatra app:
use Rack::Coffee,
:root => 'public',
:urls => '/coffee',
:join => 'index',
:bare => true
You can’t perform that action at this time.