Skip to content

Instantly share code, notes, and snippets.

# Run annotate task after db:migrate
# and db:rollback tasks
Rake::Task['db:migrate'].enhance do
Rake::Task['annotate'].invoke
Rake::Task['db:test:prepare'].invoke
end
Rake::Task['db:rollback'].enhance do
Rake::Task['annotate'].invoke
Rake::Task['db:test:prepare'].invoke
MyExceptions = [RangeError, RegexpError, IOError].freeze
begin
raise IOError, "should be rescued"
rescue *MyExceptions => e
puts e
end
@jondkinney
jondkinney / .vimrc
Created January 22, 2014 17:37
Ctags in Vim. Open in a new tab or a vertical split.
" open ctag in tab/vertical split
map <C-\> :tab split<CR>:exec("tag ".expand("<cword>"))<CR>
map <leader><C-\> :vsp <CR>:exec("tag ".expand("<cword>"))<CR>

What is a unit in TDD - a unit of work. A use-case in the system.

http://cl.ly/RY8x

3 options for a unit of work:

  • Return Value / Exception
  • Noticable State Change (adding a user for example)
  • 3rd Party Call (only place to use mock objects?)

More than just testing the implementation of the code that you're writing, or

" Reload Google Chrome on Mac from Vim.
" Adapted from: https://github.com/gcollazo/BrowserRefresh-Sublime/
function! ChromeReload()
python << EOF
from subprocess import call
browser = """
tell application "Google Chrome" to tell the active tab of its first window
reload
end tell
"""
" Reload Google Chrome on Mac from Vim.
" Adapted from: https://github.com/gcollazo/BrowserRefresh-Sublime/
function! ChromeReload()
python << EOF
from subprocess import call
browser = """
tell application "Google Chrome" to tell the active tab of its first window
reload
end tell
"""
" Reload Google Chrome on Mac from Vim.
" Adapted from: https://github.com/gcollazo/BrowserRefresh-Sublime/
function! ChromeReload()
python << EOF
from subprocess import call
browser = """
tell application "Google Chrome" to tell the active tab of its first window
reload
end tell
"""
@jondkinney
jondkinney / jondkinney_tabs.vim
Created September 3, 2013 04:00
Vim tab junk
" TABS
" ----
function! MoveCurrentTab(value)
if a:value == 0
return
endif
let move = a:value - 1
let move_to = tabpagenr() + move
if move_to < 0
let move_to = 0
Check out http://rubyonrails.org and there is a big list of resources. Some of my favorites are:
http://railscasts.com/
http://ruby5.envylabs.com/
http://guides.rubyonrails.org/
http://www.rubyinside.com/
If you want to actually get into the dev, follow this - http://ruby.railstutorial.org/
More advanced stuff (TDD / design patterns / refactoring strategies / etc) can be found here: http://destroyallsoftware.com
$ ->
$('#entry_description').simplyCountable()
$(document).on "mouseover", "*[data-zc-copy-value]", ->
that = $(this)
width = that.outerWidth()
height = that.outerHeight()
if that.data("zc-activated") isnt "true"
# init new ZeroClipboard client