Skip to content

Instantly share code, notes, and snippets.

@erichocean
erichocean / sprout-py.vcl
Created July 22, 2008 23:09
sprout-py.vcl
backend sproutcore {
set backend.host = "localhost";
set backend.port = "4020";
}
backend py {
set backend.host = "localhost";
set backend.port = "8000";
}
require 'mechanize'
user = 'xxxx'
pass = 'xxxx'
a = WWW::Mechanize.new
page_post = a.post("http://#{user}.labrute.fr/login", 'pass' => pass)
3.times do
login = ''
@elecnix
elecnix / get-all-railscasts.rb
Created November 27, 2008 02:28
Download railscasts.com archive
require 'rubygems'
require 'mechanize'
require 'net/http'
agent = WWW::Mechanize.new do |a|
a.user_agent_alias = 'Mac Safari'
end
archive = agent.get("http://railscasts.com/episodes/archive")
episodes = archive.links.select do |link|
@peterc
peterc / gist:40239
Created December 27, 2008 11:31
Configuration loading library for Sinatra apps
# NAME: configurator
# VERSION: 1.0
# AUTHOR: Peter Cooper [ http://www.rubyinside.com/ github:peterc twitter:peterc ]
# DESCRIPTION: Sinatra library to load app-wide configurations
# COMPATIBILITY: All, in theory - tested on Hoboken
# LICENSE: Use for what you want
#
# INSTRUCTIONS:
# 1. Ensure _this_ file is lib/initializer.rb within your app's directory structure
# 2. Add require 'lib/configurator' to your Sinatra app
30 12 * * * ruby /tmp/vote_for_github.rb
@Constellation
Constellation / check_followers.rb
Created January 21, 2009 12:52
check tumblr followers and followings. work with mechanize 0.9.0
#!/usr/bin/env ruby
require 'rubygems'
require 'mechanize'
require 'cgi'
email = ''
password = ''
email, password = ARGV
@darashi
darashi / sapica.rb
Created January 31, 2009 03:26
http://www.sapica.jp から SAPICA 利用履歴を取得するスクリプト
#!/usr/bin/env ruby1.9
require 'rubygems'
require 'pit'
require 'nokogiri'
require 'mechanize'
config = Pit.get('sapica', :require => {
'cardid' => 'your card id',
'password' => 'your password'
@vangberg
vangberg / app.rb
Created February 8, 2009 14:34
file upload w/ sinatra
require 'rubygems'
require 'sinatra'
get '/' do
@files = Dir['public/*'].map {|f| File.basename(f) }
erb :index
end
post '/upload' do
filename = params[:file][:filename]
@seaofclouds
seaofclouds / staticizer.rb
Created March 14, 2009 02:49 — forked from rtomayko/staticizer.rb
add static file export to sinatra apps!
# http://groups.google.com/group/sinatrarb/browse_thread/thread/84d525759af8615a
require 'fileutils'
class Staticizer
def initialize(app, cache_path)
@app = app
@cache_path = cache_path
end
def call(env)