Skip to content

Instantly share code, notes, and snippets.

View jakelodwick's full-sized avatar

Jake Lodwick jakelodwick

View GitHub Profile
# This script assumes a dump of images from the Everyday iOS app.
# It distributes all images from images/ into N subdirectories,
# starting with 1 and proceeding to N.
# the intention is to load these images into a video editor
# to make a variant of Kalina's videos that shows multiple
# images at once.
require 'FileUtils'
print "Looking for images in folder 'images'... "
@jakelodwick
jakelodwick / keezyColors.js
Created May 21, 2014 16:43
Keezy colors array
var colors = ['FC4A39', 'F7CD6C', '79F7B9', 'AFC870', 'FD9A3F', 'FC5879', 'BA63BD', '5CF196'];
@jakelodwick
jakelodwick / download.rb
Created June 22, 2014 22:25
line-broken file extension
`curl -O 'http://jakelodwick.imgix.net/bball.jpg\n'`
#current way
curl -H "Content-Type: application/json" -d '{ "msg": "your_value_here" }' https://sender.blockspring.com/api/blocks/2a5d9f4c92ae2631f3f35db803f1c52b?api_key=Log-In-to-see-your-API-key
#possible alternative
curl -H "Content-Type: application/json" -d '{ "block_id": "2a5d9f4c92ae2631f3f35db803f1c52b", "msg": "your_value_here", "api_key": "Log-In-to-see-your-API-key" }' https://sender.blockspring.com/api/
@jakelodwick
jakelodwick / gist:4b6e1f938403a1c92cf5
Created August 17, 2014 18:03
CoffeeScript in Sinatra apps
#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
@jakelodwick
jakelodwick / ppjson.coffee
Created August 17, 2014 19:01
Pretty-print JSON
# pretty-print JSON
# http://stackoverflow.com/questions/4810841/how-can-i-pretty-print-json-using-javascript
ppjson = (obj) ->
console.log JSON.stringify obj, undefined, 2
@jakelodwick
jakelodwick / array-last.coffee
Created August 17, 2014 19:02
Get last element of array
# last element of array,
# alternative to `my_array[my_array.length - 1]`
# via http://stackoverflow.com/questions/9050345/selecting-last-element-in-javascript-array
unless Array::last
Array::last = ->
this[@length - 1]
@jakelodwick
jakelodwick / phttp
Created August 18, 2014 20:54
Start webserver in current directory & open browser window to it
# 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
jakelodwick / heroku-env.sh
Created September 9, 2014 00:52
Getting Heroku environment variables into local repo
heroku plugins:install git://github.com/ddollar/heroku-config.git
heroku config:pull --overwrite --interactive
@jakelodwick
jakelodwick / vcenter.css
Created December 9, 2014 03:48
vertically center in CSS
.vcenter {
display: inline-block;
position: relative;
top: 50%;
transform: translateY(-50%);
}