Skip to content

Instantly share code, notes, and snippets.

View masonforest's full-sized avatar

Mason Fischer masonforest

View GitHub Profile
@masonforest
masonforest / gist:4107758
Created November 18, 2012 21:55
The First Runnable Gist!
name = params['name'];
callback("Hello "+name)
@masonforest
masonforest / gist:4048732
Created November 9, 2012 22:28
Installing a Gem on Heroku from a Private GitHub Repo

Installing a Gem on Heroku from a Private GitHub Repo

Sometimes you want to use a gem on Heroku that is in a private repository on GitHub.

Using git over http you can authenticate to GitHub using basic authentication. However, we don't want to embed usernames and passwords in Gemfiles. Instead, we can use authentication tokens.

  1. Get an OAuth Token from GitHub

First you will need to get an OAuth Token from GitHub using your own username and "note"

[~/tmp] gem install xcodeproj --pre
gem:14: /usr/local/bin/gem: bad interpreter: /usr/local/bin/ruby: no such file or directory
Fetching: xcodeproj-0.2.0.rc3.gem (100%)
Building native extensions. This could take a while...
Successfully installed xcodeproj-0.2.0.rc3
1 gem installed
[~/tmp] irb
zsh: /usr/local/bin/irb: bad interpreter: /usr/local/bin/ruby: no such file or directory
1.9.3-p194 :001 > project = Xcodeproj::Project.new
NameError: uninitialized constant Xcodeproj
@masonforest
masonforest / new_way.rb
Created October 12, 2012 23:06
Connascence of Position (CoP) Problem - Fixed with named parameters in Ruby 2.0
=begin
Our "Connascence of Position" problem can be solved with named parameters available in Ruby 2.0
=end
def do_things(puppie_count: 0, missle_count: 0)
puts "Played with #{puppie_count} puppies"
puts "Launched #{missle_count} missles"
end
puts "Everything is Fine"
@masonforest
masonforest / old_way.rb
Created October 12, 2012 23:03
Connascence of Position (CoP) Problem Ruby 1.9
def do_things(puppie_count, missle_count)
puts "Played with #{puppie_count} puppies"
puts "Launched #{missle_count} missles"
end
puts "Everything is Fine"
do_things(5,0)
do_things(10,0)
do_things(12,0)
@masonforest
masonforest / Log of just Web.3
Created April 18, 2012 14:11
heroku logs --tail --ps web.3 --app murfie
2012-04-18T14:07:45+00:00 heroku[web.3]: Error R14 (Memory quota exceeded)
2012-04-18T14:07:50+00:00 app[web.3]:
2012-04-18T14:07:50+00:00 app[web.3]:
2012-04-18T14:07:50+00:00 app[web.3]: Started GET "/shop.Scott1" for 10.117.7.179 at 2012-04-18 14:07:50 +0000
2012-04-18T14:07:51+00:00 app[web.3]: Processing by ShopController#index as
2012-04-18T14:07:51+00:00 app[web.3]: Rendered layouts/application.html.haml (5.0ms)
2012-04-18T14:07:51+00:00 app[web.3]: Rendered shared/_user_nav.html.haml (0.9ms)
2012-04-18T14:07:51+00:00 app[web.3]: Rendered content/_nav.html.haml (0.5ms)
2012-04-18T14:07:51+00:00 app[web.3]: Rendered shared/_footer.html.haml (1.8ms)
2012-04-18T14:07:51+00:00 app[web.3]: Rendered shared/_google_analytics.html.haml (0.0ms)
@masonforest
masonforest / Error R14
Created April 18, 2012 13:52
heroku logs --tail --app murfie |grep " Error R14"
heroku logs --tail --app murfie |grep " Error R14"
2012-04-18T13:46:26+00:00 heroku[web.3]: Error R14 (Memory quota exceeded)
2012-04-18T13:46:35+00:00 heroku[web.9]: Error R14 (Memory quota exceeded)
2012-04-18T13:46:49+00:00 heroku[web.3]: Error R14 (Memory quota exceeded)
2012-04-18T13:46:55+00:00 heroku[web.9]: Error R14 (Memory quota exceeded)
2012-04-18T13:47:11+00:00 heroku[web.3]: Error R14 (Memory quota exceeded)
2012-04-18T13:47:15+00:00 heroku[web.9]: Error R14 (Memory quota exceeded)
2012-04-18T13:47:33+00:00 heroku[web.3]: Error R14 (Memory quota exceeded)
@masonforest
masonforest / gist:2399483
Created April 16, 2012 15:30
Tracks per Disc API Call without token
curl "localhost:3000/api/discs/1636.json"
# =>
{
"disc": {
"album_id": 1515,
"amazon_id": null,
"amazon_purchase": false,
"comment": null,
"created_at": "2012-04-04T20:47:22Z",
"id": 1636,
$ curl "http://localhost:3000/api/discs/1636.json?auth_token=xxx"
{
"disc": {
"album_id": 1515,
"amazon_id": null,
"amazon_purchase": false,
"comment": null,
"created_at": "2012-04-04T20:47:22Z",
"id": 1636,
@masonforest
masonforest / gist:2284680
Created April 2, 2012 16:07
Demo API Call: Media URl
$ curl "https://murfie2-staging.herokuapp.com/api/discs.json?auth_token=XXX"
$ curl "https://murfie2-staging.herokuapp.com/api/discs/1631/tracks/95945.json?auth_token=XXX"
=> {"track":{"id":95945,"url":"https://murfie-streaming-test.s3.amazonaws.com/2/1.mp3?key=XXX"}}