Skip to content

Instantly share code, notes, and snippets.

require 'oauth/consumer'
# need to define methods: app_name, developer_key, developer_secret
consumer = OAuth::Consumer.new(developer_key,
developer_secret,
:site => "http://api.netflix.com",
:request_token_url => "http://api.netflix.com/oauth/request_token",
:access_token_url => "http://api.netflix.com/oauth/access_token",
:authorize_url => "https://api-user.netflix.com/oauth/login")
request_token = consumer.get_request_token
@boscomonkey
boscomonkey / gem install heroku error 1
Created April 29, 2009 18:28
command line error when installing Heroku gem
Building native extensions. This could take a while...
ERROR: Error installing heroku:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.8 extconf.rb
extconf.rb:1:in `require': no such file to load -- mkmf (LoadError)
from extconf.rb:1
Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/json-1.1.4 for inspection.
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- net/https (LoadError)
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /usr/lib/ruby/gems/1.8/gems/rest-client-0.9.2/lib/restclient.rb:2
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /usr/lib/ruby/gems/1.8/gems/rest-client-0.9.2/lib/rest_client.rb:2
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /usr/lib/ruby/gems/1.8/gems/heroku-0.8/bin/../lib/heroku/client.rb:2
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
!!! The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again: gem install mysql.
rake aborted!
no such file to load -- mysql
(See full trace by running task with --trace)
Building native extensions. This could take a while...
ERROR: Error installing sqlite3-ruby:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.8 extconf.rb
checking for fdatasync() in -lrt... yes
checking for sqlite3.h... no
make
make: *** No rule to make target `ruby.h', needed by `sqlite3_api_wrap.o'. Stop.
#/bin/sh
# git-zip.sh
#
# Creates a zip file of the HEAD of the current git repository
CWD=`basename $PWD`
git archive --format=zip --prefix=${CWD}/ -9 HEAD > ../${CWD}.zip
#!/bin/sh
# Transcode an MMS into an H.264 in an .mp4 container.
# Usage: transcode_vlc.sh mms://foo.com/bar.wmv bar.mp4
vlc $1 :sout '#transcode{vcodec=h264,vb=800,scale=1,acodec=mp4a,ab=128,channels=2}:duplicate{dst=std{access=file,mux=mp4,dst=$2}}' :sout-all
# This RoR controller uses "protect_from_forgery" declaration to let anyone
# perform a POST to create another instance of an UnsafeObject.
#
class UnsafeObjectsController < ApplicationController
protect_from_forgery :except => :create
# ...
end
// Java snippet for GWT to trap keyboard keyUp events at the document level.
// In other words, no KeyUpHandler needed (nor does Document provide a hook).
Event.addNativePreviewHandler(new Event.NativePreviewHandler() {
@Override
public void onPreviewNativeEvent(NativePreviewEvent event) {
if (event.getTypeInt() == Event.ONKEYUP) {
// do something with the key code
// doSomething(event.getNativeEvent().getKeyCode());
#
# personal account
#
Host personal.repositoryhosting.com
Hostname personal.repositoryhosting.com
IdentitiesOnly yes
IdentityFile ~/.ssh/id_dsa
#
# corporate account
#