Skip to content

Instantly share code, notes, and snippets.

View johnnygoodman's full-sized avatar

Johnny Goodman johnnygoodman

View GitHub Profile
johnny@johnny-laptop:~/www/blog$ gst
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# deleted: vendor/plugins/12_hour_time/CHANGELOG
#
# Changed but not updated:
# (use "git add/rm <file>..." to update what will be committed)
#
johnny@johnny-laptop:~/www/blog/config$ gst | more
# On branch master
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
#
# modified: ../app/views/posts/index.html.erb
# modified: ../db/development.sqlite3
# modified: ../log/development.log
# modified: ../public/stylesheets/scaffold.css
#
1. I didn't have the .gitignore file in place before my first commit
2. git add . && git commit -a -m "first commit"
3. git rm -f db/development.sqlite3
4. git rm -f log/development.log
5. rails error message
6. git revert <last known good rev>
7. fatal: Dirty index: cannot revert
8. git add -f db/development.sqlite3
9. git add -f log/development.log (command failed)
require 'rubygems'
require 'differ'
# Question: Is there a way to say match 1 or more instances of a defined subsequence/grouping?
original = "Epic lolcat fail bellmead drive!"
current = "Epic wolfman fail bellmead dr!"
diff = Differ.diff_by_word(current, original).to_s
puts diff # => "Epic {"lolcat" >> "wolfman"} fail bellmead {"drive" >> "dr"}!
require 'rubygems'
require 'differ'
original = "Epic lolcat fail bellmead drive!"
current = "Epic wolfman fail bellmead dr!"
diff = Differ.diff_by_word(current, original).to_s
# => "Epic {"lolcat" >> "wolfman"} fail bellmead {"drive" >> "dr"}!
original = "Same Same diff Same Same diff Same Same diff"
require 'rubygems'
require 'differ'
# There could be only one match
original = "Epic lolcat fail bellmead drive!"
current = "Epic wolfman fail bellmead dr!"
diff = Differ.diff_by_word(current, original).to_s
# => "Epic {"lolcat" >> "wolfman"} fail bellmead {"drive" >> "dr"}!
require 'rubygems'
require 'mechanize'
require 'date'
require 'logger'
agent = Mechanize.new { |a| a.log = Logger.new("mech.log") }
agent.follow_meta_refresh = true
page = agent.get 'https://www.cpap.com/MadCowModular/main.php'
//Every USPS Address Abbreviation (Source: http://www.usps.com/ncsc/lookups/usps_abbreviations.html)
$uspsAbbrArray = array("aly", "anx", "arc", "ave", "ave", "byu", "bch", "bnd", "blf", "blfs", "btm", "blvd", "br", "brg", "brk", "brks", "bg", "bgs", "byp", "cp", "cyn", "cpe", "cswy", "ctr", "ctrs", "cir", "cirs", "clf", "clfs", "clb", "cmn", "cmns", "cor", "cors", "crse", "ct", "cts", "cv", "cvs", "crk", "cres", "crst", "xing", "xrd", "xrds", "curv", "dl", "dm", "dv", "dr", "drs", "est", "ests", "expy", "ext", "exts", "fall", "fls", "fry", "fld", "flds", "flt", "flts", "frd", "frds", "frst", "frg", "frgs", "frk", "frks", "ft", "fwy", "gdn", "gdns", "gtwy", "gln", "glns", "grn", "grns", "grv", "grvs", "hbr", "hbrs", "hvn", "hts", "hwy", "hl", "hls", "holw", "inlt", "is", "iss", "isle", "jct", "jcts", "ky", "kys", "knl", "knls", "lk", "lks", "land", "lndg", "ln", "lgt", "lgts", "lf", "lck", "lcks", "ldg", "loop", "mall", "mnr", "mnrs", "mdw", "mdws", "mews", "ml", "mls", "msn", "mtwy", "mt", "mtn", "mtns", "n
require 'pp'
h = { "1"=>"overallconstruct",
"2"=>
{ "report"=>87396,
"modified"=>"2010-08-09 07:44:39",
"rawamount"=>"36.00",
"category"=>36679,
},
"3"=>1523332}
Johnny-Goodmans-MacBook-Pro:railsbbq johnnygoodman$ rvm list
rvm rubies
ruby-1.8.7-p174 [ x86_64 ]
ruby-1.8.7-p302 [ x86_64 ]
ruby-1.9.2-head [ x86_64 ]
ruby-1.9.2-rc2 [ ]
Johnny-Goodmans-MacBook-Pro:railsbbq johnnygoodman$ rvm use 1.9.2-head