This file contains hidden or 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 | |
| $:.unshift File.dirname(__FILE__)+"/../lib" | |
| require 'mongomapper' | |
| require 'irb' | |
| IRB.setup(nil) | |
| irb = IRB::Irb.new | |
| IRB.conf[:MAIN_CONTEXT] = irb.context |
This file contains hidden or 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://unicorn.bogomips.org/SIGNALS.html | |
| rails_env = ENV['RAILS_ENV'] || 'production' | |
| rails_root = ENV['RAILS_ROOT'] || "/data/github/current" | |
| God.watch do |w| | |
| w.name = "unicorn" | |
| w.interval = 30.seconds # default | |
| # unicorn needs to be run from the rails root |
This file contains hidden or 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 'open-uri' | |
| # url dsl -- the ultimate url dsl! | |
| # | |
| # You just can't beat this: | |
| # | |
| # $ irb -r url_dsl | |
| # >> include URLDSL | |
| # => Object | |
| # >> http://github.com/defunkt.json |
This file contains hidden or 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 'spec/matchers/wrap_expectation' | |
| require 'nokogiri' | |
| class BeHtmlWith | |
| def matches?(stwing, &block) | |
| @scope.wrap_expectation self do | |
| begin | |
| bwock = block || @block || proc{} | |
| builder = Nokogiri::HTML::Builder.new(&bwock) | |
| match = builder.doc.root |
This file contains hidden or 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
| desc "Runs mongodb" | |
| task :mongodb => %w{mongodb:install mongodb:run} | |
| namespace :mongodb do | |
| task :install do | |
| next if File.exist?("vendor/mongodb/1.4.0") | |
| if RUBY_PLATFORM =~ /darwin/ # OSX | |
| system <<-bash | |
| mkdir -p #{Rails.root}/vendor/mongodb/data | |
| curl http://downloads.mongodb.org/osx/mongodb-osx-x86_64-1.4.0.tgz -o /tmp/mongodb.tgz |
This file contains hidden or 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 "json" | |
| require "open-uri" | |
| CONCURSOS = 1188..1195 | |
| APOSTAS = [[10, 12, 14, 34, 37, 49], [14, 27, 31, 39, 40, 53], [2, 10, 22, 43, 44, 51]] | |
| CONCURSOS.each do |concurso| | |
| resultado = JSON.load(open("http://apiz.heroku.com/megasena/#{concurso}.json")) rescue next |
This file contains hidden or 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 'dnssd' | |
| @hosts = Array.new | |
| DNSSD.browse! '_mongodb._tcp' do |service| | |
| DNSSD.resolve! service do |r| | |
| @hosts << {:host => r.target, :port => r.port} | |
| break unless r.flags.more_coming? | |
| end | |
| break unless service.flags.more_coming? |
This file contains hidden or 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
| ~/Projects/globo/chef-repo (master)$ brew outdated | |
| node (0.1.100, 0.1.101, 0.1.104, 0.1.31, 0.1.32, 0.1.33, 0.1.90, 0.1.91, 0.1.93, 0.1.94, 0.1.96, 0.1.97, 0.1.99 < 0.1.104) | |
| pango (1.26.2, 1.28.0 < 1.28.1) | |
| pcre (8.02 < 8.10) | |
| pip (0.6.3, 0.7.2 < 0.8) | |
| scala (2.7.7 < 2.8.0) | |
| scons (1.3.0, 20090919 < 2.0.0) | |
| skipfish (1.29b, 1.30b, 1.32b, 1.33b, 1.34b, 1.41b < 1.55b) | |
| sqlite (3.6.22, 3.6.23, 3.6.23.1, 3.7.0 < 3.7.0.1) | |
| tokyo-cabinet (1.4.42, 1.4.45 < 1.4.46) |
This file contains hidden or 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 "nokogiri" | |
| class SitemapBuilder | |
| attr_reader :root | |
| def initialize | |
| @urls = Array.new | |
| @root = File.expand_path("public", Rails.root) | |
| Dir[File.join(root, "sitemap*")].each{|f| FileUtils.rm f} | |
| end |
This file contains hidden or 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
| REDIS_VERSION = "2.0.4" | |
| task :redis => "redis:start" | |
| namespace :redis do | |
| task :install do | |
| next if File.exist?("#{Rails.root}/vendor/redis/#{REDIS_VERSION}/redis-server") | |
| system <<-bash | |
| curl http://redis.googlecode.com/files/redis-#{REDIS_VERSION}.tar.gz -o /tmp/redis.tar.gz | |
| mkdir -p #{Rails.root}/vendor/redis |
OlderNewer