Skip to content

Instantly share code, notes, and snippets.

View albertoperdomo's full-sized avatar

Alberto Perdomo albertoperdomo

View GitHub Profile
@burke
burke / 0-readme.md
Created January 27, 2012 13:44 — forked from funny-falcon/cumulative_performance.patch
ruby-1.9.3-p327 cumulative performance patch for rbenv

ruby-1.9.3-p327 cumulative performance patch for rbenv

This installs a patched ruby 1.9.3-p327 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.

Requirements

You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf using homebrew.

@raul
raul / retry_upto.rb
Created October 7, 2011 06:42
retry_upto.rb
# Ruby `retry` with steroids:
#
# - retry up to 5 times without waiting between them and retrying after any exception
#
# retry_upto(5) do ... end
#
# - retry up to 5 times, waiting 2 seconds between retries
#
# retry_upto(5, :wait => 2) do ... end
#
@jc00ke
jc00ke / assets.rake
Created September 25, 2011 18:26 — forked from mulder/assets.rake
Monkey Patch for assets:precomple for deploying on Heroku with Mongoid
namespace :assets do
# Prepend the assets:precompile_prepare task to assets:precompile.
task :precompile => :precompile_prepare
# This task will be called before assets:precompile to optimize the
# compilation, i.e. to prevent any DB calls.
task 'precompile_prepare' do
# Without this assets:precompile will call itself again with this var set.
# This basically speeds things up.
ENV['RAILS_GROUPS'] = 'assets'
@ryanb
ryanb / spec_helper.rb
Created September 12, 2011 21:29
Focus on specific specs in RSpec
# add this to your spec helper
RSpec.configure do |config|
config.treat_symbols_as_metadata_keys_with_true_values = true
config.filter_run :focus => true
config.run_all_when_everything_filtered = true
end
# and then use the :focus tag in your specs
it "does something awesome", :focus do
@ayosec
ayosec / sites-map-reduce.js
Created August 25, 2011 17:25
MapReduce: count sites per country
db.sites.insert({"cities": [ { "country" : { "code" : "ES" } } ] });
db.sites.insert({"cities": [ { "country" : { "code" : "US" } } ] });
db.sites.insert({"cities": [ { "country" : { "code" : "US" } } ] });
db.sites.insert({"cities": [ { "country" : { "code" : "ES" } } ] });
db.sites.insert({"cities": [ { "country" : { "code" : "PT" } } ] });
db.sites.insert({"cities": [ { "country" : { "code" : "BR" } } ] });
db.sites.insert({"cities": [ { "country" : { "code" : "BR" } } ] });
db.sites.insert({"cities": [ { "country" : { "code" : "CA" } } ] });
db.sites.insert({"cities": [ { "country" : { "code" : "CA" } } ] });
db.sites.insert({"cities": [ { "country" : { "code" : "CA" } } ] });
@javan
javan / gist:1168475
Created August 24, 2011 16:32
Fix iPhone home button
Found this tip in comment here: http://www.tipb.com/2011/01/04/tipb-bug-home-button-working-iphone/
1.) Open any application
2.) Press and hold the power button until the slide to shutdown swipe bar appears.
3.) Release Power button
4.) Press and hold Home button Lightly
until screen returns to icon screen
@bradphelan
bradphelan / pageview.js.coffee
Created June 15, 2011 13:46
backbone based mobile page model
#=require haml
#=require backbone
class PageView extends Backbone.View
tag: "div"
class: "page"
classes: ->
[]
@christos
christos / jazzfonica.rb
Created June 14, 2011 09:37
jazzfonica
#!/usr/bin/env ruby
# jazzfonica.rb for Mac OS X
# Scans the visible networks for JAZZTEL_XXXX or WLAN_XXXX and calculates the password
# Ported from PHP example at http://kz.ath.cx/wlan/codigo.txt
# Download and execute with ruby (e.g. ruby jazzfonica.rb) from a Terminal
require 'digest/md5'
messages = []
unless !File.exists?('/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport')
configuration = configure do |config|
config.tail_logs = true
config.max_connections = 55
config.admin_password = 'secret'
config.app_server do |app_server_config|
app_server_config.port = 8808
app_server_config.admin_password = config.admin_password
end
end
@leshill
leshill / gist:870866
Created March 15, 2011 15:17
Cucumber/Capybara JS alert handling
# Add this to more_web_steps.rb
# Selenium docs: http://code.google.com/p/selenium/wiki/RubyBindings#Javascript_Alert/Confirm today!
When /^I (accept|dismiss) the "([^"]*)" alert$/ do |action, text|
alert = page.driver.browser.switch_to.alert
alert.text.should eq(text)
alert.send(action)
end