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
# create remote tracking branch | |
git branch --track feature1 origin/master |
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
lsof -w -n -i tcp:3000 | |
fuser -n tcp 3000 | |
netstat -anp|grep :3000[[:blank:]] | |
kill -9 pidnumber |
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
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 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
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 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
module MyCoolModule | |
class Configuration | |
attr_accessor :my_value | |
def initialize | |
# set defaults | |
end | |
end | |
def self.configure |
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
:read !pbpaste | |
bash$ pbpaste | vim - | |
"*P |
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 'JSON' | |
puts JSON.pretty_generate(JSON.parse('{"array":[1,2,3,{"sample":"hash"}],"foo":"bar"}')) | |
{ | |
"array": [ | |
1, | |
2, | |
3, | |
{ |
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
git branch -m old_branch new_branch |
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
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'nokogiri' | |
require 'open-uri' | |
heroku_status_url = "https://status.heroku.com" | |
doc = Nokogiri::HTML(open(heroku_status_url)) | |
problems, problem_types = [], { "app" => "App Operations", "tools" => "Tools" } |
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
#define SuperRandom (arc4random() % ((unsigned)RAND_MAX + 1)) | |
float objectiveFunction(NSArray *vector) { | |
float result = 0.0; | |
for (id element in vector) { | |
result += [element floatValue]; | |
} | |
return result; | |
} |