Skip to content

Instantly share code, notes, and snippets.

View keithcelt's full-sized avatar

Keith Swallow keithcelt

  • Los Angeles, CA
View GitHub Profile
@keithcelt
keithcelt / conditional-test.rb
Created June 21, 2018 18:41
Test conditionals in Ruby
def a
puts "hi" and return :hi if true
end
def b
(puts "hi" and return :hi) if true
end
def c
puts "hi" && return(:hi) if true

Keybase proof

I hereby claim:

  • I am keithcelt on github.
  • I am keithcelt (https://keybase.io/keithcelt) on keybase.
  • I have a public key whose fingerprint is DF71 EC22 3B38 183D F327 D983 D79A 4D2E 9BF9 BBE5

To claim this, I am signing this object:

@keithcelt
keithcelt / ar_sql_console.rb
Created January 21, 2016 19:36
AR SQL in IRB/PRY
ActiveRecord::Base.logger = Logger.new(STDOUT)
# formatting for copypasta
@keithcelt
keithcelt / keith.zsh-theme
Created October 15, 2012 22:15
My ZSH Theme
function ruby_version() {
if [[ -s ~/.rvm/scripts/rvm ]] ; then
echo $(~/.rvm/bin/rvm-prompt)
fi
}
function show_git_branch() {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$ZSH_THEME_GIT_PROMPT_SUFFIX"
}
@keithcelt
keithcelt / GSE Bash
Created October 3, 2012 20:46
Bash scripts for GSE
i() {
if [[ -s tmp/isolate ]] ; then
echo "\$ rake isolate:sh['$*']"
rake isolate:sh\["$*"\]
else
echo "\$ bundle exec $*"
bundle exec $*
fi
afplay /System/Library/Sounds/Hero.aiff
}
@keithcelt
keithcelt / GSE ZSH
Created October 3, 2012 18:28
ZSH scripts for GSE
i() {
if [[ -s tmp/isolate ]] ; then
echo "\$ rake isolate:sh['$*']"
rake isolate:sh\["$*"\]
else
echo "\$ bundle exec $*"
bundle exec $*
fi
afplay /System/Library/Sounds/Hero.aiff
}
@keithcelt
keithcelt / spec_helper.rb
Created March 16, 2012 14:14 — forked from sethbro/spec_helper.rb
Rails unit, functional and integration tests in Minitest spec format.
ENV["RAILS_ENV"] = "test"
require File.expand_path('../../config/environment', __FILE__)
require 'rubygems'
gem 'minitest'
require 'minitest/autorun'
require 'action_controller/test_case'
require 'miniskirt'
require 'capybara/rails'