Skip to content

Instantly share code, notes, and snippets.

require 'mechanize'
require 'hpricot'
class Orkut
def initialize(email, pass)
@agent = WWW::Mechanize.new
@email = email
@pass = pass
end
#!/usr/bin/ruby -W0
=begin
Quick and dirty way to tweet the currently active
Safari tab (title + shortened URL). Hashtags get
passed in as parameters (the hash sign gets added
by the script, so don't do it yourself)
Adapt to your needs!
=end
require 'rbosa'
song = OSA.app('iTunes').current_track.name.gsub(/\(.*\)/, '').gsub(/\s/,'%20')
system("open -a Safari http://www.google.com/search?q=#{song}+lyrics")
#!/usr/bin/env ruby
# Made by Pieter de Bie <frimmirf@gmail.com>
# Based on a "Pastie" task by someone
require "tempfile"
GIST_URL = 'http://gist.github.com/gists'
GIST_LOGIN_URL = 'https://gist.github.com/session'
USERNAME = "martinisoft"
TOKEN = "6ef8395fecf207165f1a82178ae1b984"
@deminew
deminew / README
Created March 31, 2009 18:13 — forked from vangberg/README
# Deploying a Sinatra app to Heroku
## Database
The location of the database Heroku provides can be found in the environment
variable DATABASE_URL. Check the configure-block of toodeloo.rb for an example
on how to use this.
## Server
Heroku is serving your apps with thin, with means you have all your thin goodness available,
such as EventMachine.
class File
def replace(pattern, string)
full_path = File.expand_path path
return unless File.file?(full_path)
reopen(full_path, 'r')
lines = readlines
changes = false
lines.each_with_index do |line, index|
#!/usr/local/bin/ruby
require 'rubygems'
require 'twitter'
require 'open-uri'
require 'nokogiri'
TARGET_USER = "aplusk"
TARGET_COUNT = 1_000_000
URL = "http://twitter.com/#{TARGET_USER}"
ID = '#follower_count'
#!/bin/bash
projects=( rails active_merchant activerecord_i18n_defaults adva_cms amqp ansuz apache-upload-progress-module backports braid click-to-globalize clj-garden cucumber cucumber-tmbundle custom_resource_name deprec design_patterns_in_ruby exception_notification git-me-up git_depot globalize2 globalize2-demo grit http_accept_language insoshi isitjruby jrails jruby-rack lighthouse-api merb-internals-handbook mizuho mspec panda paperclip poignant-br prawn rails-template rake-compiler reia rhodes rhosync rquery rspec rspec-rails ruby-benchmark-suite rubyspec sake-tasks saushengine scanty snippets standalone-migrations translate_routes translator twitter vim-git vim-rails webrat )
for repo in ${projects[@]}; do
echo "Updating repo [$repo]"
cd /Users/akitaonrails/Sites/rails/$repo
git checkout master
git pull
done
function fetch {
require "rubygems"
require 'mechanize'
agent = WWW::Mechanize.new
response = agent.get("http://twitter.com/statuses/user_timeline/samuraicoder.xml")
xml = response.content
doc = Nokogiri::XML(xml)
doc.search("text").each do |text|
p text.inner_html
end
require 'rubygems'
require 'benchmark'
gem = ARGV.shift.strip rescue ''
if gem == ''
STDERR.puts "usage: #{$0} [gem]"
exit 1
end
`free`