Skip to content

Instantly share code, notes, and snippets.

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 / 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
@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: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'
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" }
modelName = $('#review_filter').val() || "dispensary"
$('#review_filter_query').attr("placeholder","#{modelName.capitalize}")
$('#review_filter_query').attr("data-autocomplete", "/admin/reviews/autocomplete_#{modelName}_name")
$.fn.capitalize ->
$.each this, ->
caps = this.value
caps = caps.charAt(0).toUpperCase() + caps.slice(1)
this.value = caps
return this
platform: &platform
<% if RUBY_PLATFORM == "java" %>
adapter: jdbcpostgresql
<% else %>
adapter: postgresql
<% end %>
default: &default
<<: *platform
username: dreamr
@dreamr
dreamr / gist:5228649
Created March 23, 2013 17:41
#~/.bash_profile
. /usr/local/etc/bash_completion.d/git-prompt.sh
. /usr/local/etc/bash_completion.d/git-completion.bash
export PS1='\[\033[01;32m\]\h\[\033[01;34m\] \w\[\033[31m\] $(__git_ps1 "(%s)") \[\033[01;34m\]$\[\033[00m\] '
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" }