- To use the API, you’ll first need an API Key.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Parses the itunes playlist xml file and sticks it in a mysql table. | |
# Gem requirements: | |
# ActiveRecord | |
# Hpricot | |
# Create a database called "itunes_library" | |
# Schema is as follows: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SUPER DARING APP TEMPLATE 1.0 | |
# By Peter Cooper | |
# Link to local copy of edge rails | |
inside('vendor') { run 'ln -s ~/dev/rails/rails rails' } | |
# Delete unnecessary files | |
run "rm README" | |
run "rm public/index.html" | |
run "rm public/favicon.ico" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SUPER DARING APP TEMPLATE 1.0 | |
# By Peter Cooper | |
# Link to local copy of edge rails | |
inside('vendor') { run 'ln -s ~/dev/rails/rails rails' } | |
# Delete unnecessary files | |
run "rm README" | |
run "rm public/index.html" | |
run "rm public/favicon.ico" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# requires curb gem (http://curb.rubyforge.org/) | |
# I used matthooks’ vimeo gem to get the required token, sig and ticket. http://github.com/matthooks/vimeo/tree/master | |
# (flickraw has an alternative method of doing a http POST in the source using net/http which could be adapted for vimeo, avoiding the use of this curb gem) | |
# connect to Vimeo | |
VIMEO_API_KEY = "your api key" | |
VIMEO_SHARED_SECRET = "your shared secret" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'daemons' | |
dir = File.expand_path(File.join(File.dirname(__FILE__), '..')) | |
daemon_options = { | |
:multiple => false, | |
:dir_mode => :normal, | |
:dir => File.join(dir, 'tmp', 'pids'), | |
:backtrace => true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
helpers do | |
# Construct a link to +url_fragment+, which should be given relative to | |
# the base of this Sinatra app. The mode should be either | |
# <code>:path_only</code>, which will generate an absolute path within | |
# the current domain (the default), or <code>:full_url</code>, which will | |
# include the site name and port number. The latter is typically necessary | |
# for links in RSS feeds. Example usage: | |
# | |
# link_to "/foo" # Returns "http://example.com/myapp/foo" | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[08:48 AM:gist-99771(master)] $ irb -rubygems -r myapp.rb -r rack/test | |
>> app = Rack::Test::Session.new(Sinatra::Application) | |
=> #<Rack::Test::Session:0x17e8820 @headers={}, @app=Sinatra::Application> | |
>> app.get '/' | |
=> #<Rack::Response:0x17ad4dc @block=nil, @writer=#<Proc:0x0189f7b4@/opt/local/lib/ruby/gems/1.8/gems/rack-0.9.1/lib/rack/response.rb:24>, header{"Content-Type"=>"text/html", "Content-Length"=>"7"}, body["testing"], length7, status200 | |
>> app.body | |
NoMethodError: undefined method `body' for #<Rack::Test::Session:0x17e8820> | |
from (irb):3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blake:carealot$ irb -rubygems -r myapp.rb -r sinatra/test | |
irb(main):001:0> app = Sinatra::TestHarness.new(Sinatra::Application) | |
=> #<Sinatra::TestHarness:0x10c3d74 @app=Sinatra::Application> | |
irb(main):002:0> app.get '/' | |
=> #<Rack::MockResponse:0x10ae780 @original_headers={"Content-Type"=>"text/html", "Content-Length"=>"7"}, @status=200, @errors="", @headers={"Content-Type"=>"text/html", "Content-Length"=>"7"}, @body="testing"> | |
irb(main):003:0> app.body | |
=> "testing" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# How to setup multiple heroku accounts | |
# (assuming you already have one setup) | |
# make sure ~/bin is in your path | |
create ~/bin/hcred and populate it with the following: | |
1 #!/usr/bin/env ruby | |
2 | |
3 `rm ~/.heroku/credentials` |
OlderNewer