Skip to content

Instantly share code, notes, and snippets.

View jakelodwick's full-sized avatar

Jake Lodwick jakelodwick

View GitHub Profile
@jakelodwick
jakelodwick / integration_request.vtl
Created March 12, 2016 17:13
AWS API Gateway - Integration Request - Mapping Template
#*
Via <http://kennbrodhagen.net/2015/12/06/how-to-create-a-request-object-for-your-lambda-event-from-api-gateway/>.
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
jakelodwick / inject-jquery.js
Last active January 20, 2016 17:49
Inject jQuery into any webpage through the console
// paste this into your browser's console and jQuery will be loaded
var jq = document.createElement('script');
jq.type = 'text/javascript';
jq.src = '//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js';
document.head.appendChild(jq);
@jakelodwick
jakelodwick / gist:8378421
Created January 11, 2014 23:35
Nice quotes in CSS, within a <q> tag
q:before { content: '\201C' }
q:after { content: '\201D'; }
@jakelodwick
jakelodwick / loadSamples.coffee
Created December 21, 2015 22:16
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
jakelodwick / outlines.css
Created January 17, 2013 04:12
CSS snippet that puts colored outlines (NOT borders) around all elements on page. I did not create this, but I forget where I got it.
* { outline: 1px dotted red } * * { outline: 1px dotted green } * * * { outline: 1px dotted orange } * * * * { outline: 1px dotted blue } * * * * * { outline: 1px solid fuchsia } * * * * * * { outline: 1px solid teal } * * * * * * * { outline: 1px solid indigo } * * * * * * * * { outline: 1px solid brown }
@jakelodwick
jakelodwick / current-local-ip
Created January 7, 2013 18:28
Simple shell script to get your machine's current local IP.
# type this in a terminal window to get your current local ip address:
ifconfig | grep 192 | awk '{print $2}'
# add this to whatever file runs when you open a new shell
# (~/.profile on OS X)
alias ip="ifconfig | grep 192 | awk '{print \$2}'"
# now you can type "ip" in a terminal window to get your local ip.
# note: you can replace "ip" with whatever you want.
@jakelodwick
jakelodwick / http-to-https.coffee
Created October 26, 2015 20:32
redirect from http to https
if location.protocol is "http:"
window.location = window.location.toString().replace("http:", "https:")
@jakelodwick
jakelodwick / gist:3007505
Created June 27, 2012 23:15
horizontally center absolutely positioned elements
$(window).resize(function(){
$('#someElement').each(function(i) {
$(this).css('left', ($(this).parent().width() - $(this).outerWidth(true)) / 2);
});
}).resize();
@jakelodwick
jakelodwick / neat_r.php
Created January 8, 2011 17:27
neat_r, a tidy alternative to print_r (PHP)
<?PHP
/*
neat_r works like print_r but with much less visual clutter.
By Jake Lodwick. Copy freely.
Example with an array:
$data = array(
"mode" => "sets",

Setting up Caffe for Running Deepdream on OS X

Dependencies

Use Brew

Install brew and pip (sudo easy_install pip)

brew update
brew install homebrew/science/openblas