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
backend sproutcore { | |
set backend.host = "localhost"; | |
set backend.port = "4020"; | |
} | |
backend py { | |
set backend.host = "localhost"; | |
set backend.port = "8000"; | |
} | |
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 'rubygems' | |
require 'mechanize' | |
agent = WWW::Mechanize.new | |
page = agent.get('http://google.com/') | |
myfile = File.new('links.txt', 'w+') | |
page.links.each do |link| | |
myfile.puts(link.text) | |
end |
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 'mechanize' | |
user = 'xxxx' | |
pass = 'xxxx' | |
a = WWW::Mechanize.new | |
page_post = a.post("http://#{user}.labrute.fr/login", 'pass' => pass) | |
3.times do | |
login = '' |
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 '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| |
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
# 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 |
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
30 12 * * * ruby /tmp/vote_for_github.rb |
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 'mechanize' | |
require 'cgi' | |
email = '' | |
password = '' | |
email, password = ARGV |
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 ruby1.9 | |
require 'rubygems' | |
require 'pit' | |
require 'nokogiri' | |
require 'mechanize' | |
config = Pit.get('sapica', :require => { | |
'cardid' => 'your card id', | |
'password' => 'your password' |
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 'rubygems' | |
require 'sinatra' | |
get '/' do | |
@files = Dir['public/*'].map {|f| File.basename(f) } | |
erb :index | |
end | |
post '/upload' do | |
filename = params[:file][:filename] |
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
# 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) |
OlderNewer