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
describe "something", :focus => true do | |
it 'does something' | |
end | |
rspec spec/something.rb:8 | |
rspec spec/something.rb -t focus | |
rspec spec/something.rb -e 'example name' |
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
http://user-contributions.org/wikis/userwiki/index.php?title=Bash-to-Ruby | |
http://www.grymoire.com/Unix/Sed.html | |
http://www.thegeekstuff.com/2009/12/unix-sed-tutorial-6-examples-for-sed-branching-operation/ | |
http://www.catonmat.net/blog/sed-one-liners-explained-part-one/ | |
http://www.catonmat.net/blog/awk-one-liners-explained-part-one/ | |
http://sed.sourceforge.net/local/docs/emulating_unix.txt | |
http://www.eng.cam.ac.uk/help/tpl/unix/sed.html | |
Ruby: | |
File.read('somefile.txt').split("\n").join(" ") |
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
lsof -w -n -i tcp:3000 | |
fuser -n tcp 3000 | |
netstat -anp|grep :3000[[:blank:]] | |
kill -9 pidnumber |
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
# create remote tracking branch | |
git branch --track feature1 origin/master |
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
# rm /var/lib/pgsql/data | |
# service postgresql initdb | |
# service postgresql start | |
# vim /var/lib/pgsql/data/pg_hba.conf | |
replace ident with trust |
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 OptionFilter | |
def initialize(default_opts) | |
@default_opts = default_opts | |
end | |
def generate(param_name, label_value_pairs) | |
@copy = @default_opts.clone | |
@current_param = param_name | |
label_value_pairs.each { |pair| yield pair[0], opts_for(pair[1]) } | |
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 'benchmark' | |
MAX = 10_000_000 | |
Benchmark.bm(3) do |b| | |
b.report("push") do | |
arr = [] | |
MAX.times {|i| arr.push(i.to_s)} | |
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 "benchmark" | |
require "rspec" | |
module RSpec | |
module Benchmark | |
class Result | |
attr_accessor :slowest, :fastest, :average, :elapsed | |
def initialize(elapsed) | |
@elapsed = elapsed |
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 Array | |
# Largest range with different subsequence, | |
# without any kind of clever optimization. | |
def range_with_diff_subseq(other) | |
self_size = self.size | |
other_size = other.size | |
low = 0 | |
max_pos = self_size < other_size ? self_size : other_size |
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
Flash objects do not obey z-index. This is particularly often found on youtube vids.. | |
To solve this, pass wmode parameter with transparent value... like this: www.youtube.com/embed/somecode?wmode=transparent | |
$(function() {}); seems to wait for document ready forever, if it's invoked on a popup. Well um.. or probably because the document is already 'ready', the piece of code inside that function won't be even executed. | |
Instead, put the thing inside that function near the end of </body> tag... please, only if it's a popup. lolplz.. |