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
brew install cowsay | |
x = (<<'END') | |
don't escape the backslash, f.ex /\:/\ | |
END | |
IO.popen(['cowsay', message]) do |process| | |
process.read | |
end | |
$ bundle init |
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 Fixnum | |
def to_lcd_matrix(sep=' ') | |
segments_per_row_per_digit=[ | |
' ._. ._. __. ._. ._. __. ._. ._.' .scan(/ (...)/).flatten, | |
' | | | ._| __| |_| |_. |_. _| |_| |_|' .scan(/ (...)/).flatten, | |
' |_| | |_. __| | ._| |_| ..| |_| ._|' .scan(/ (...)/).flatten | |
] | |
lcd_rows = [[],[],[]] | |
self.to_s.chars.each do |s| | |
digit = s.to_i |
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
i - OUTSIDE CALL (calling this private method is normally forbidden) | |
a_method was called | |
i - INSIDE CALL | |
a_method was called | |
Process finished with exit code 0 |
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/sh | |
bundle install | tail -1 | |
rm log/test.lo* 2> /dev/null | |
rm log/cucumber.lo* 2> /dev/null | |
echo ----------------------------- | |
echo TEST UNIT ... | |
echo ----------------------------- |
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
$(document).ready(function() { | |
$('textarea.word_count').each(function(){ | |
var maxlimit = parseInt($(this).attr('maxlength')); | |
// ...on page load | |
var length = $(this).val().length; | |
if(length >= maxlimit) { | |
$(this).val($(this).val().substring(0, maxlimit)); |
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 'test_helper' | |
module ActiveSupport | |
class TestCase < Test::Unit::TestCase | |
# Correct Usage : | |
# def test_ok_pending_1 | |
# pending "feature 1 should do this ..." | |
# 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
# 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 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 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 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 : |