Skip to content

Instantly share code, notes, and snippets.

require 'builder'
@cwoodcox
cwoodcox / logged-in
Created November 19, 2014 18:08
Weird
Started GET "/products/die-cut-stickers" for 127.0.0.1 at 2014-11-19 12:47:59 -0500
Processing by Spree::ProductsController#show as HTML
Parameters: {"id"=>"die-cut-stickers"}
Spree::Preference Load (0.4ms) SELECT "spree_preferences".* FROM "spree_preferences" WHERE "spree_preferences"."key" = 'spree/frontend_configuration/locale' LIMIT 1
Spree::User Load (0.3ms) SELECT "spree_users".* FROM "spree_users" WHERE "spree_users"."deleted_at" IS NULL AND "spree_users"."id" = 1 ORDER BY "spree_users"."id" ASC LIMIT 1
Spree::Store Load (0.3ms) SELECT "spree_stores".* FROM "spree_stores" WHERE (url like '%rockin-stickers.dev%') ORDER BY "spree_stores"."id" ASC LIMIT 1
Spree::Store Load (0.3ms) SELECT "spree_stores".* FROM "spree_stores" WHERE "spree_stores"."default" = 't' ORDER BY "spree_stores"."id" ASC LIMIT 1
Spree::Order Load (0.4ms) SELECT "spree_orders".* FROM "spree_orders" WHERE "spree_orders"."completed_at" IS NULL AND "spree_orders"."currency" = 'USD' AND "spree_orders"."guest_
@cwoodcox
cwoodcox / tmux.conf
Created November 19, 2014 18:46
My interactive project opening thing
# Open a project interactively
unbind C-p
bind-key C-p \
command-prompt -p "client:","project:" "\
new-session -A -c ~/Projects/%1/%2 -s %2 -n code 'reattach-to-user-namespace -l vim'\;\
new-window -d -n console 'tail -f log/development.log'\;\
split-window -v -t 1 'rails c'\;\
next-window"
class StringJoiner
def call string1, string2
"#{string1}#{string2}"
end
end
join = StringJoiner.new
join.call("this ", "is normal")
# => "this is normal"
@cwoodcox
cwoodcox / arr_hash_total.rb
Created August 11, 2011 19:40
Array of Hashes Totaling
array = [{:stat1 => 34, :stat2 => 37}, {:stat1 => 45, :stat2 => 78}]
total = {}
array.each do |element|
element.each do |key, val|
total[key] ||= 0
total[key] += val
end
end
@cwoodcox
cwoodcox / download_all.rb
Created August 19, 2011 08:44
Download'em
#! /usr/bin/ruby
# This little guy will download and save all the URLs it can find from the file it retrieves from a
# given URL. Works awesomely for Apache index pages of lots of image files. Like http://bukk.it
SELECT
T.DateOpenedUTC
,C.DataContent
,T.subject
FROM st_Tickets T
LEFT JOIN st_CustomDataFieldsInTickets C
ON (T.TicketID = C.TicketID)
LEFT JOIN (
SELECT <fourth column here>, Tin.TicketID
chuck@chuck:~/Sites/fastfill → ruby-1.9.2-p290@fastfill → master $ brew install memcached
==> Installing memcached dependency: libevent
==> Downloading http://monkey.org/~provos/libevent-2.0.12-stable.tar.gz
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/libevent/2.0.12
==> make install
/usr/local/Cellar/libevent/2.0.12: 47 files, 1.9M, built in 37 seconds
==> Installing memcached
==> Downloading http://memcached.googlecode.com/files/memcached-1.4.6.tar.gz
######################################################################## 100.0%
@cwoodcox
cwoodcox / uninstall_homebrew.sh
Created September 15, 2011 05:26 — forked from mxcl/uninstall_homebrew.sh
Uninstall Homebrew
#!/bin/sh
# Just copy and paste the lines below
# MAKE SURE YOU ARE HAPPY WITH WHAT IT DOES FIRST! THERE IS NO WARRANTY!
cd `brew --prefix`
git ls-files -z | pbcopy
rm -rf Cellar
bin/brew prune
pbpaste | xargs -0 rm
rm -r Library/Homebrew Library/Aliases Library/Formula Library/Contributions