- Mac OS X 10.7.2
- Homebrew 0.8.1
- Apple Command Line Tools
- ZSH
- Git 1.7.5.4
- RVM 1.10.1
- Ruby 1.9.3
- Passenger 3.0.11
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 "nokogiri" | |
require "open-uri" | |
def download(url, output_file) | |
exit unless system("wget -c #{url} --load-cookies=cookies.txt -O #{output_file}") | |
end | |
def download_pages |
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 'markdown' | |
src_file = ARGV[0] | |
File.open(src_file) do |src| | |
content = Markdown.new(src.read).to_html | |
template = DATA.read | |
puts template.gsub(/#\{content\}/, content) |
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 | |
# API Documentation at http://api.wikia.com/wiki/LyricWiki_API | |
require 'open-uri' | |
require 'json' | |
require 'tmpdir' | |
ARTIST = "Johnny Cash" |
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
Copyright 2011 Mike Tigas. All rights reserved. | |
Redistribution and use in source and binary forms, with or without modification, are | |
permitted provided that the following conditions are met: | |
1. Redistributions of source code must retain the above copyright notice, this list of | |
conditions and the following disclaimer. | |
2. Redistributions in binary form must reproduce the above copyright notice, this list | |
of conditions and the following disclaimer in the documentation and/or other materials |
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
after "deploy:symlink", "deploy:restart_workers" | |
after "deploy:restart_workers", "deploy:restart_scheduler" | |
## | |
# Rake helper task. | |
# http://pastie.org/255489 | |
# http://geminstallthat.wordpress.com/2008/01/27/rake-tasks-through-capistrano/ | |
# http://ananelson.com/said/on/2007/12/30/remote-rake-tasks-with-capistrano/ | |
def run_remote_rake(rake_cmd) | |
rake_args = ENV['RAKE_ARGS'].to_s.split(',') |
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
class User < ActiveRecord::Base | |
attr_accessible :email, :password, :password_confirmation, :first_name, :last_name, :zipcode | |
attr_accessor :password | |
before_save :encrypt_password | |
validates_confirmation_of :password | |
validates_presence_of :password, :on => :create | |
validates_presence_of :email | |
validates_uniqueness_of :email |
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
# Mechanize tests with Orkut/Twitter | |
# @author Davis Zanetti Cabral | |
# Orkut usage example: | |
# >> require 'jum_proxy' | |
# >> orkut = JumProxy::Sites::Orkut.new("daviscabral@gmail.com", "pa$$w0rd", "pt-BR") | |
# >> orkut.scraps | |
# | |
# Twitter usage example: | |
# >> require 'jum_proxy' |
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
#-*- coding: utf-8 -*- | |
require 'rubygems' | |
require 'mechanize' | |
require 'kconv' | |
agent = Mechanize.new | |
agent.get('https://login.keio.jp/koid/') | |
agent.page.form_with(:action => 'login') do |form| | |
form.field_with(:name => 'SignOnID').value = "my user ID" |
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
require 'net/http' | |
require 'uri' | |
require 'rubygems' | |
require 'json' | |
reddit_api_url = "http://www.reddit.com/.json" | |
resp = Net::HTTP.get_response(URI.parse(reddit_api_url)) | |
data = resp.body | |
result = JSON.parse(data) |