Skip to content

Instantly share code, notes, and snippets.

guard "minitest", all_on_start: false, rerun: false do
# with Minitest::Spec
watch(%r|^test/(.*)_test\.rb|)
watch(%r|^lib/(.*)([^/]+)\.rb|) { |m| "test/#{m[1]}#{m[2]}_test.rb" }
watch(%r|^test/minitest_helper\.rb|) { "test" }
watch(%r|^test/support/|) { "test" }
# Rails 3.2
watch(%r|^app/controllers/(.*)\.rb|) { |m| "test/controllers/#{m[1]}_test.rb" }
watch(%r|^app/mailers/(.*)\.rb|) { |m| "test/mailers/#{m[1]}_test.rb" }
guard "minitest", all_on_start: false, rerun: false do
# with Minitest::Spec
watch(%r|^test/(.*)_test\.rb|)
watch(%r|^lib/(.*)([^/]+)\.rb|) { |m| "test/#{m[1]}#{m[2]}_test.rb" }
watch(%r|^test/minitest_helper\.rb|) { "test" }
watch(%r|^test/support/|) { "test" }
# Rails 3.2
watch(%r|^app/controllers/(.*)\.rb|) { |m| "test/controllers/#{m[1]}_test.rb" }
watch(%r|^app/mailers/(.*)\.rb|) { |m| "test/mailers/#{m[1]}_test.rb" }
@dreamr
dreamr / gist:5523315
Created May 6, 2013 04:13
What is wrong with these tests? (Phil cannot answer)
FAIL WeedMapsAPI::V1::DispensaryDetailCall::with a clean index#test_0001_returns dispensary details (0.00s)
--- expected
+++ actual
@@ -1,3 +1,3 @@
{:z=>105, :n=>"Dr. Greenthumb Garden Supply 142", :i=>0, :distance=>13, :hits=>0, :a=>"175 River Terrace Fremont Ca 94539", :phone=>"555-555-1142", :rating=>0.0, :y=>-121.9674, :x=>37.5770843, :h=>"10am - 10pm", :d=>"4g eighths, Referrals - free eighth", :link=>"http://example.com/dispensaries/xxx", :kinds=>"2 sativa 1 indica", :photos=>[], :reviews=>[{:z=>63, :name=>"username508", :i=>"", :title=>"This is a cool place.", :r=>5, :comments=>"And I like it.\r
-", :when=>"May 5th, 2013"}, {:z=>62, :name=>"username507", :i=>"", :title=>"This is a cool place.", :r=>5, :comments=>"And I like it.\r
-", :when=>"May 5th, 2013"}]}
+", :when=>"May 6th, 2013"}, {:z=>62, :name=>"username507", :i=>"", :title=>"This is a cool place.", :r=>5, :comments=>"And I like it.\r
+", :when=>"May 6th, 2013"}]}
(eval):8:in `must_equal'
@dreamr
dreamr / gist:5767710
Created June 12, 2013 18:13
~/.bash_prompt
function _git_prompt() {
local git_status="`git status -unormal 2>&1`"
if ! [[ "$git_status" =~ Not\ a\ git\ repo ]]; then
if [[ "$git_status" =~ nothing\ to\ commit ]]; then
local ansi=42
elif [[ "$git_status" =~ nothing\ added\ to\ commit\ but\ untracked\ files\ present ]]; then
local ansi=43
else
local ansi=45
fi
@dreamr
dreamr / gist:5767737
Created June 12, 2013 18:16
most used commands
history | awk '{a[$2]++}END{for(i in a){print a[i] " " i}}' | sort -rn | head -15
describe "with nested collateral" do
let(:parent) { create :collateral, attachment: hotplay }
before do
HotplayViewer.create(user: user, hotplay: hotplay)
get :index, format: :json
end
it { assert_response :success }
it { response.headers["Content-Type"].must_include "application/json" }
@dreamr
dreamr / my_functional_logger.rb
Last active December 18, 2015 21:19
My stab at functional coding in Ruby!
# simply takes an array and joins it with --'s
format_log_line = ->(func) {
if func.kind_of?(Array)
func.flatten.compact.join(" -- ").concat("\n")
else
func
end
}
# write a file, functional stylee
@dreamr
dreamr / gist:5888851
Created June 28, 2013 23:11
pretty git log
alias gl='git log --pretty='\''format:%Cblue%h%d%Creset %ar %Cgreen%an%Creset %s'\'' --graph'
fdebe0c (dreamr/invite_template_save) 2 days ago Dreamr Merge pull request #366 from 01Click/dreamr/buyer_collateral_internal
* 9dcc48d (dreamr/buyer_collateral_internal) 2 days ago Dreamr OKelly added internal back into buyer collateral
719ba6d 2 days ago Dreamr OKelly added source to collateral form
95bd9da 2 days ago Dreamr OKelly removed buyer video
6434d9a 2 days ago Dreamr OKelly buyers don't need child collateral
5e55876 (dreamr/faster_ci_via_bucket) 3 days ago Dreamr OKelly testing faster ci
b8ae03e 3 days ago Danny Bosan fix formatting problem in yml
34910bf 3 days ago Danny Bosan whitespace change after travis command
2e25271 3 days ago Danny Bosan remove duplicate ENV vars
1c6d6f5 3 days ago Danny Bosan secure the last remaining ENVs
<div id="content">
<ul id="hotplay_tabs">
<li class="selected">
<a href="/hotplays/58">Main</a>
</li>
<li class="">
<a href="/hotplays/58/targeting">Targeting</a>
</li>
<li class="">
<a href="/hotplays/58/crm">CRM</a>