Skip to content

Instantly share code, notes, and snippets.

@indec
indec / switch_audio.applescript
Last active December 17, 2015 21:09
An Applescript to cycle the audio input and output sources between two (or more) audio devices
on alfred_script(q)
set output_devices to {"Display Audio", "Generic USB Audio Device "}
set input_devices to {"Display Audio", "Generic USB Audio Device "}
set device_keywords to {"speakers", "headphones"}
tell application "System Preferences"
reveal anchor "output" of pane id "com.apple.preference.sound"
tell application "System Events"
tell process "System Preferences"
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@stevebourne
stevebourne / Gemfile
Created April 15, 2012 19:28
Add facebook auth to a Clearance app, using omniauth-facebook
gem 'omniauth'
gem 'omniauth-facebook'
gem 'clearance'
#!/usr/bin/env ruby
# serve the contents under www/ with a web server via port 8080 and proxy all
# requests to /api/* to an external API
# Steven Wilkin | @stevebiscuit
require 'net/http'
require 'webrick'
require 'uri'
@nhocki
nhocki / gist:1095522
Created July 20, 2011 18:11 — forked from croaky/gist:1089598
Transfer data from production to staging on Heroku
heroku addons:add pgbackups --remote staging
heroku addons:add pgbackups --remote production
heroku pgbackups:capture --remote production
heroku pgbackups:restore DATABASE `heroku pgbackups:url --remote production` --remote staging