Skip to content

Instantly share code, notes, and snippets.

View albertoperdomo's full-sized avatar

Alberto Perdomo albertoperdomo

View GitHub Profile
@ayosec
ayosec / pocket.rake
Created January 28, 2011 11:39
Xiraxi - AssetPocket
paths = Rails.application.railties.engines.map {|e| e.root }
paths.push Rails.root
# Load every stylesheet in application.css
sass "public/stylesheets/application.css" do
# First load the basics/*.scss and then the rules
["basics/", ""].each do |prefix|
paths.reverse.each do |path|
#!/bin/sh
export RUBY_HEAP_MIN_SLOTS=500000
export RUBY_HEAP_SLOTS_INCREMENT=250000
export RUBY_GC_MALLOC_LIMIT=50000000
export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1
/opt/ruby-enterprise/bin/rake "$@"
@lenary
lenary / gitconfig.ini
Created February 18, 2011 01:21
a special excerpt of my gitconfig
$ git clone github:lenary/guides.git
Cloning into guides...
remote: Counting objects: 255, done.
remote: Compressing objects: 100% (216/216), done.
remote: Total 255 (delta 111), reused 163 (delta 35)
Receiving objects: 100% (255/255), 1.49 MiB | 564 KiB/s, done.
Resolving deltas: 100% (111/111), done.
$ cd guides
$ git remote -v
require 'rubygems'
begin
require 'cucumber'
require 'cucumber/rake/task'
Cucumber::Rake::Task.new(:features) do |t|
t.cucumber_opts = "--format pretty"
end
task :features => 'db:test:prepare'
rescue LoadError
@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
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
@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')
@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: ->
[]
@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
@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" } } ] });