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/local/bin/ruby | |
require 'rubygems' | |
gem 'rest-client' | |
gem 'main' | |
gem 'highline' | |
require 'restclient' | |
require 'main' | |
require 'highline/import' |
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/local/bin/ruby | |
missing_images = {} | |
grep_regexp = %q|/images[^\"\']*\....| | |
reference_and_image_paths = IO.popen('grep -ro "' + grep_regexp + '" app/views public/stylesheets').readlines | |
reference_and_image_paths.each do |reference_and_image_path| | |
reference, image_path = reference_and_image_path.split(":") | |
if image_path | |
image_path.gsub!(/^\//, 'public/').strip! | |
unless File.exists?(image_path) |
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
#!/bin/bash | |
if [ -n "$1" ] | |
then | |
filter=$1 | |
else | |
echo "Usage: run_tests filtering_keyword" | |
exit | |
fi |
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/local/bin/ruby | |
require 'rubygems' | |
gem 'mechanize' | |
gem 'main' | |
gem 'highline' | |
require 'mechanize' | |
require 'main' | |
require 'highline/import' |
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 'preforker' | |
require 'eventmachine' | |
class EchoServer < EM::Connection | |
def notify_readable | |
while socket = @io.accept_nonblock | |
message = socket.gets | |
socket.write message | |
socket.close |
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
# cd into matching gem directory ("cd -" friendly) | |
cdgem() { | |
local gempath=$(gem env gemdir)/gems | |
if [[ $1 == "" ]]; then | |
cd $gempath | |
return | |
fi | |
local gem=$(ls $gempath | g $1 | sort | tail -1) | |
if [[ $gem != "" ]]; then |
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
class Object | |
def send(*args, &block) | |
"no soy sarasa porque me piso el send" | |
end | |
def sarasa | |
"soy sarasa" | |
end | |
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
#!/usr/bin/env ruby | |
require 'benchmark' | |
Benchmark.bm do|b| | |
b.report("block") do | |
(1..1000000).map {|n| Math.log(n) } | |
end | |
b.report("to_proc") do | |
(1..1000000).map &Math.method(:log) |
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 'state_pattern' | |
class Stop < StatePattern::State | |
def next | |
sleep 3 | |
transition_to(Go) | |
end | |
def color | |
"Red" |
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
#sugared | |
do -> | |
class Animal | |
constructor: (@name) -> | |
move: (meters) -> | |
alert @name + " moved #{meters}m." | |
class Snake extends Animal | |
move: -> |