Skip to content

Instantly share code, notes, and snippets.

View amerine's full-sized avatar
🌅
Out West

Mark Turner amerine

🌅
Out West
View GitHub Profile
class Foo extends Backbone.model
init: ->
@on "change:date change:time", ->
@set {correct_time: @get("date") + @get("time")},
this
@amerine
amerine / tpl-basicapp.rb
Created May 15, 2012 07:28 — forked from jetspeed/tpl-basicapp.rb
Rails 3, RSpec, Factory_Girl, HAML, SASS, Devise, JQuery, Backbone.js, jammit, haml.js
## Rails App Template
## Useful for Rails 3.0.x and Ruby 1.9.2
## Run using $ rails new [appname] -JT -m tpl-basicapp.rb
# ========
# = Gems =
# ========
# pre-install spork, dydram and elastic_searchable
run "gem install spork -v 0.9.0.rc --pre"
@amerine
amerine / connection_fix.rb
Created December 31, 2011 00:28 — forked from defunkt/connection_fix.rb
MySQL server has gone away fix
# If your workers are inactive for a long period of time, they'll lose
# their MySQL connection.
#
# This hack ensures we re-connect whenever a connection is
# lost. Because, really. why not?
#
# Stick this in RAILS_ROOT/config/initializers/connection_fix.rb (or somewhere similar)
#
# From:
# http://coderrr.wordpress.com/2009/01/08/activerecord-threading-issues-and-resolutions/
yum erase ruby ruby-libs
rpm -Uvh http://rbel.co/rbel5
yum install ruby
@amerine
amerine / gist:1341224
Created November 5, 2011 07:14
polio cowboy
,,,,,,,,,,,,,;,,,,,,;,,,;,;,,;;,,;;,;,,;,;,,;;,;;;;;;,;;;,;,;;,,,,;,;,,,,,,,,,,,,,,,,
,,,,,,,;,3,,,,,;;,,;,;;;,;,;;,,;,,;,;;,;;;;;;,;;;,;,;,,,;,,;,,;,;,,,,,,,,,,,,,,,,,,,,
,,,;;,,;33,,,,,;;,,,,,,,;,;,,;;,;,,;;;;;;;;;;;;;;;,;;;;;,;,,;,,,,,,,,,,,,,,,,,,,,,,,,
,,,;;,,;33,,,;;;;,;,,,,,,,,,,,,,,,,,,,,,,,,;,,,,,,,,,,,,;,;,,,;;;,;,,,,;;,,,,,,,,,,,,
,,,,;,33f8oooo"""ooo,;,,,,,;,,;;;,;;,,,,;;,,,,,;,,,,,;,,,;,,;;;;,;;;,;,;;;;;;,,,,,,,,
,,,,,,;3f8oo;;o"o;;o,,,,,,,,,,,,,,ox8xxCC`CC8";,,,,,,,,,,,,,,,,,,,,,,;,,,,,;,,,,,,,,,
,,,,,,;,"fooo;;o;;;;,,,,,,,,,o"``AAA}AAAA````CCC",,,,,,,,,,,,,,,,,,,,;,,,,,,,,,,,,,,,
,,,,,,3;3foo;;;o;;;;,,,,,,,8`AAAAA`````````CCC8CCC;,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
3;;;;3333"o;;"";o;;;,,,,,,oCC```````OC`O`````CC88CC;,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,3,;,,;;;3;oooooo;;;,,,,,,,"CCCC`x`CCC8"CCC``CCCC88C,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
@amerine
amerine / gist:1265199
Created October 5, 2011 18:10 — forked from kalv/gist:913392
Clear out Resque messages that have Decode errors.
# Use from console, was required as old messages were incorrectly encoded and placed on the failed queue
# preventing us to view the failed queue.
include Resque::Helpers
Resque::Failure.count.times do |index|
puts "Checking #{index}"
begin
decode Resque.redis.lindex(:failed, index)
rescue Resque::Helpers::DecodeException
@amerine
amerine / rspec-syntax-cheat-sheet.rb
Created July 1, 2011 23:20 — forked from dnagir/rspec-syntax-cheat-sheet.rb
RSpec 2 syntax cheat sheet by example
# RSpec 2.0 syntax Cheet Sheet by http://ApproachE.com
# defining spec within a module will automatically pick Player::MovieList as a 'subject' (see below)
module Player
describe MovieList, "with optional description" do
it "is pending example, so that you can write ones quickly"
it "is already working example that we want to suspend from failing temporarily" do
pending("working on another feature that temporarily breaks this one")
@amerine
amerine / app.rb
Created February 22, 2011 07:25 — forked from densone/gist:838331
require 'rubygems'
require 'bundler'
Bundler.require(:default)
REST OF YOUR APP
; <<>> DiG 9.6.0-APPLE-P2 <<>> www.storquest.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 20195
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 0
;; QUESTION SECTION:
;www.storquest.com. IN A
; <<>> DiG 9.6.0-APPLE-P2 <<>> www.conservatoryseniorliving.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 9688
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 2, ADDITIONAL: 0
;; QUESTION SECTION:
;www.conservatoryseniorliving.com. IN A