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
| # How to print the stacktrace from anywhere : | |
| # 1° | |
| #------------------------------------------------------------------------------ | |
| module Kernel | |
| def print_stacktrace | |
| raise | |
| rescue | |
| puts $!.backtrace[1..-1].join("\n") | |
| 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
| # modified version of http://github.com/gittobi/tobi_test_timer | |
| # differences : | |
| # - prints all the tests | |
| # - adds a counter and a bargraph | |
| # | |
| # output : | |
| #. 336 2222222 : 2.584 - test_create_an_image_with_some_participations_in_one_go(ImageAdvancedTest) | |
| #. 337 ++ : 0.173 - test cleanup_user_picture_path() does not translate proper upload | |
| #. 338 ++ : 0.135 - test cleanup_user_picture_path() translates tmp upload path(ImagePathRepairTest) | |
| #. 339 : 0.005 - test shorten_image_url() clears 1 level(ImagePathRepairTest) |
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
| # download and git methods swiped from http://github.com/Sutto/rails-template/blob/07b044072f3fb0b40aea27b713ca61515250f5ec/rails_template.rb | |
| require 'open-uri' | |
| def download(from, to = from.split("/").last) | |
| #run "curl -s -L #{from} > #{to}" | |
| file to, open(from).read | |
| rescue | |
| puts "Can't get #{from} - Internet down?" | |
| exit! |
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 "openssl" | |
| require "net/smtp" | |
| Net::SMTP.class_eval do | |
| private | |
| def do_start(helodomain, user, secret, authtype) | |
| raise IOError, 'SMTP session already started' if @started | |
| check_auth_args user, secret, authtype if user or secret |
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
| #autotest configuration | |
| # | |
| require 'redgreen/autotest' | |
| require 'autotest/timestamp' | |
| # #################### | |
| # GROWL CONFIG | |
| # #################### |
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 'parallel' #http://github.com/grosser/parallel | |
| $stdout.sync = true # Auto-flush for interactive I/O | |
| def slow_action | |
| def fibo(n) | |
| 0 == n ? 0 : | |
| 1 == n ? 1 : |
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
| # Usage : | |
| # -------- | |
| # require 'setup_once' | |
| # class MyTest < Test::Unit::TestCase | |
| # include SetupOnce | |
| # | |
| # def self.setup_once | |
| # puts "doing one-time setup" | |
| # 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
| source ~/.git-completion.sh | |
| alias gco='git co' | |
| alias gci='git ci' | |
| alias grb='git rb' | |
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
| # with Daemons, extract the params. for the daemonized process | |
| # | |
| # Input : | |
| # ["run", "--", "--source=/tmp/sour", "--archive=/tmp/arch"] | |
| # ^ ^^^^^^^^^ ^^^^^^^^^ | |
| # | :source :archive | |
| # the separator | |
| # | |
| # Output : | |
| # {:source=>"/tmp/sour", :archive=>"/tmp/arch"} |
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 'test_helper' | |
| module ActiveSupport | |
| class TestCase < Test::Unit::TestCase | |
| # Correct Usage : | |
| # def test_ok_pending_1 | |
| # pending "feature 1 should do this ..." | |
| # end |
OlderNewer