Skip to content

Instantly share code, notes, and snippets.

View IanVaughan's full-sized avatar
👯‍♀️
OMG

Ian Vaughan IanVaughan

👯‍♀️
OMG
View GitHub Profile
@IanVaughan
IanVaughan / README.md
Created June 10, 2012 13:11
rbenv gems discspace
$ du -sh ~/.rbenv/versions/*
213M  /Users/ivaughan/.rbenv/versions/1.9.2-p290
546M  /Users/ivaughan/.rbenv/versions/1.9.3-p0
552M  /Users/ivaughan/.rbenv/versions/1.9.3-p125
876M  /Users/ivaughan/.rbenv/versions/ree-1.8.7-2011.03
996M  /Users/ivaughan/.rbenv/versions/ree-1.8.7-2012.01
388M  /Users/ivaughan/.rbenv/versions/ree-1.8.7-2012.02

$ du -sh ~/.rbenv/versions/*

213M /Users/ivaughan/.rbenv/versions/1.9.2-p290

@IanVaughan
IanVaughan / README.md
Created June 10, 2012 13:13
rbenv gemsets again
$ <.rbenv-version
ree-1.8.7-2012.02

$ <.rbenv-gemsets
zsh: no such file or directory: .rbenv-gemsets

$ >.rbenv-gemsets
portal-sites

$ <.rbenv-gemsets

@IanVaughan
IanVaughan / cheat.md
Created June 19, 2012 14:52
HAML to ERB (for dummies like me!)
just replace % to <>if there's no %, it assumes div
HAML ERB comment
% tag/tagname
@IanVaughan
IanVaughan / whoa.md
Created June 26, 2012 23:22
Ruby, hashes, and default params

I was surprised by where my params were going with a call to a method with defaulted hash parameters.

So I tested it in IRB, and here are the results.

Create test program

def test(a, h1={}, h2={})
  pp a
  pp h1

pp h2

Here is a file with
a
few lines.
@IanVaughan
IanVaughan / tags.sh
Created September 6, 2012 17:56
Get git tags
list=`git tag`
for tag in $list; do
echo "$tag : " >> result.txt
git co $tag 2>&1 > /dev/null
grep -w s.version wld.gemspec >> result.txt
done
@IanVaughan
IanVaughan / Markdown.MD
Created February 6, 2013 09:48
Markdown cheat sheet
Left align Right align Center align
This This This
column column column
will will will
be be be
left right center
aligned aligned aligned
@IanVaughan
IanVaughan / inspect.sh
Created February 8, 2013 16:05
Quickly inspect database from the command line
mysql -h $HOST -u $USER -p $PASSWORD -e "use $DATABASE; describe $TABLE;" | grep $FIELD

Compare with ST2

  1. New File wants to save
  2. No Preview on Go To File
  3. No Code Folding
  4. No preview on Search results, just filenames
@IanVaughan
IanVaughan / how_to.sh
Last active December 16, 2015 08:09
Running a single fucking test spec
# ActiveSupport::TestCase
ruby -I"lib:test" test/unit/file.rb -n test_name
# rspec v1 (http://stackoverflow.com/a/143934/119790)
rake spec SPEC=spec/controllers/sessions_controller_spec.rb \
SPEC_OPTS="-e \"should log in with cookie\""
# or
spec spec/controllers/sessions_controller_spec.rb -l 73