Skip to content

Instantly share code, notes, and snippets.

View ryanlindsey's full-sized avatar
🏠
Working from home

Ryan Lindsey ryanlindsey

🏠
Working from home
  • California
View GitHub Profile
@ryanlindsey
ryanlindsey / pgbackup.sh
Created January 3, 2014 19:34
Import Heroku Postgres to Localhost
$ heroku pgbackups:capture
$ curl -o latest.dump `heroku pgbackups:url`
$ pg_restore --verbose --clean --no-acl --no-owner -h localhost -U MyUser -d MyDB latest.dump
@ryanlindsey
ryanlindsey / gem_cleaning.sh
Created November 12, 2013 17:58
gem cleaning
# dry run first
$ gem cleanup your_gem_name -d
$ gem cleanup your_gem_name -v
@ryanlindsey
ryanlindsey / osx_dock_spacer.sh
Created October 6, 2013 20:24
Easily add spacers to your OSX Dock with this terminal command
$ defaults write com.apple.dock persistent-apps -array-add '{tile-data={}; tile-type="spacer-tile";}'
$ killall Dock
@ryanlindsey
ryanlindsey / power_settings
Created August 10, 2013 18:27
OSX 10.8 Power Settings
sudo pmset hibernatemode 0
sudo pmset standby 0
sudo pmset autopoweroff 0
@ryanlindsey
ryanlindsey / app_controller.rb
Created May 30, 2013 21:26
An example Rails 3.2 controller that sets the CORS access control headers for cross-domain access
class ApplicationController < ActionController::Base
protect_from_forgery
before_filter :cors_preflight_check
after_filter :cors_set_access_control_headers
# For all responses in this controller, return the CORS access control headers.
def cors_set_access_control_headers
headers['Access-Control-Allow-Origin'] = '*'
@ryanlindsey
ryanlindsey / gist:5579630
Last active December 17, 2015 08:19
Music API Albums Example
GET http://music.ryanlindsey.me/api/albums
{"album_count":959,"album_names":["(500) Days Of Summer: Music From The Motion Picture","(What's The Story) Morning Glory?","+ (Cross)","...And Justice For All","...And The Circus Leaves Town","...I Care Because You Do","...Was A Real Boy (Explicit)","2001 (Instrumentals)","39 Minutes Of Bliss (In An Otherwise Meaningless World)","4 AM","835","A Book Like This","A Bothered Mind","A Drowning (Radio Single)","A Heaping Helping Of Perspective","A Lesson In Crime","A Lot Like Love: Music From The Motion Picture","A Real Hero - EP","A Strange Education","A2G","ATLiens (Explicit)","Abbey Road","Above","Achtung Baby","Adore","Adventures In Foam","Aftermath","Alice In Chains","All Of This And Nothing","All That You Can't Leave Behind","All Time Greatest Hits","All Tomorrow's Parties 3.1","Alopecia","Alphabetical","American III: Solitary Man","American Teen: Music From The Motion Picture","American V: A Hundred Highways","Amnesiac","An Introduction To Ellie Goulding","And Al
@ryanlindsey
ryanlindsey / artists.sh
Last active December 17, 2015 08:19
Example requesting all artists from Music API
GET http://music.ryanlindsey.me/api/artists
import org.json.*;
import java.util.Iterator;
import java.util.Map;
public static class MusicAPI {
// Setup API endpoints
protected String request_url = "http://music.ryanlindsey.me/api";
protected String api_random_track = "/track/random";
protected String api_latest_track = "/track/latest";
@ryanlindsey
ryanlindsey / gist:5120705
Created March 8, 2013 22:59
Example of jQuery Event Bubbling
$('body').on 'click', '.my-selector', (e) ->
# Do something here
e.preventDefault()
@ryanlindsey
ryanlindsey / make_app
Created March 5, 2013 18:51
Convert web app to native
#!/bin/sh
echo "What should the Application be called (no spaces allowed e.g. GCal)?"
read inputline
name=$inputline
echo "What is the url (e.g. https://www.google.com/calendar/render)?"
read inputline
url=$inputline