Skip to content

Instantly share code, notes, and snippets.


Chris Toomey christoomey

View GitHub Profile
christoomey / sql_query_countiner.rb
Created May 19, 2020
SQL Queries Summaries helper
View sql_query_countiner.rb
module SqlQueryCountingHelpers
# This helper can be used to instrument a segment of test code to analyze the
# SQL queries being executed for that portion of the code path.
# It's intended to be used around specific portions of a spec rather than an
# entire spec as the FactoryBot usage adds a good amount of noise to the SQL
# analysis due to the many objects & associations created.
# Usage example (using spec/requests/api/v1/projects_spec.rb):
View news_link_spec.rb
View strip_extraneous_whitespace.vim
" Strip extraneous whitespace (duplicate or trailing) in current paragraph.
function! s:StripDuplicateWhitespace()
let save_cursor = getpos(".")
normal! {jms
normal! }me
's,'es/\S\@<=\s\{2,}/ /g
call setpos('.', save_cursor)
command! StripDuplicateWhitespace call <sid>StripDuplicateWhitespace()
christoomey / email-button-markup.html
Created Nov 3, 2015
Reliable button markup for use in email templates
View email-button-markup.html
<div><!--[if mso]>
<v:roundrect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" href=";utm_medium=email&amp;utm_campaign=day-1-of-5-assessing-your-skills-and-filling-in-the-gaps" style="height:40px;v-text-anchor:middle;width:200px;" arcsize="10%" strokecolor="#b6bc38" fillcolor="#db6d14">
<center style="color:#ffffff;font-family:sans-serif;font-size:18px;font-weight:bold;">See the Rails Trail</center>
<![endif]--><a href=";utm_medium=email&amp;utm_campaign=day-1-of-5-assessing-your-skills-and-filling-in-the-gaps">See the Rails Trails</a></div>
  • Demo error
  • Describe feature spec
  • rails/info
  • discuss ctags of gems (link to videos)
  • better_errors
  • binding.pry
    • show_source
  • bundle show --paths
    • Upcase spec/features/user_accepts_team_invitation_spec.rb:13 (using_session)
    • method(:using_session).source_location
christoomey /
Created Jul 22, 2014
Collection of Reading on JS Promises

JS Promises

[Intro to Q library][] is a great starting point

Other recommended reading:

  • [PromisesJS Intro Article][] a good starting place
  • A good [article about what exactly promise objects are][]
  • [Great article][] that builds up a simple Promise implementation incremenetally
christoomey /
Last active Jan 4, 2018
Configuration for better JSON editing in Vim

Install jsonlint to act as syntastic json checker:

$ npm install jsonlint -g

Tell syntatastic about it:

" in your ~/.vimrc

Keybase proof

I hereby claim:

  • I am christoomey on github.
  • I am christoomey ( on keybase.
  • I have a public key whose fingerprint is DFE3 B12A 74A7 63B1 3CF9 CEC6 9273 CF6D 703D CCC8

To claim this, I am signing this object:

christoomey /
Last active Aug 29, 2015
Angular $watch gotcha

Turns out that angular $watch statements will always fire once to "initialize" the 'watch' statement. The officially recommended workaround, should you not want this behavior, is to use an object identity check to compare the values, ie:

$scope.$watch 'allProviders', (selected, prior) ->
  return if selected is prior
christoomey /
Last active Aug 29, 2015
Talk notes from my Vim for Ruby and Rails talk at BostonRb's March 2014 meetup