Skip to content

Instantly share code, notes, and snippets.

View sevenseacat's full-sized avatar
🏠
Working remotely

Rebecca Le sevenseacat

🏠
Working remotely
View GitHub Profile
lypanov: anyone experience with unicorn and preload app? i see tons of mysql errors.
sevenseacat: im not sure what mysql errors would have to do with unicorn
lypanov: sevenseacat: then you don't use it i'm guessing
sevenseacat: nope.
lypanov: anyone?
waseem_: lypanov: What errors?
lypanov: Mysql2::Error: Lost connection to MySQL server during query. and lots of other random AR errors. tables not existing etc.
lypanov: alas googling is getting me nowhere
lypanov: there is an item on the mysql2 gem, closed, but zero real closure on the issue.
waseem_: lypanov: Can you connect to MySQL with credentials in yoru database.yml?
@sevenseacat
sevenseacat / Dobdark.tmTheme
Last active October 10, 2015 01:07
The Dobdark textmate theme that I use across all of my Sublime Text 2s.
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>Dobdark</string>
<key>settings</key>
<array>
<dict>
<key>settings</key>
Practical Object-Oriented Design in Ruby
Metaprogramming Ruby
Cucumber Recipes
Rapid Android Development
Hello, Android
Retinafy Me
Exceptional Ruby
Scalable and Modular Architecture for CSS
Growing Object-Oriented Software, Guided By Tests
Rails Recipes
RSpec::Matchers.define :assign_to do |variable|
chain :with do |value|
@value = value
end
match do |response|
if @value
assigns[variable] == @value
else
assigns.has_key?(variable)
Capybara.register_driver :phantomjs do |app|
Capybara::Selenium::Driver.new(app, browser: :phantomjs)
end
Capybara.javascript_driver = :phantomjs
@sevenseacat
sevenseacat / albums
Last active December 14, 2015 13:48
Music missing from Spotify
Frenzal Rhomb - everything pre-Shut Your Mouth
Jorn - everything pre-2006 (in particular, Out To Every Nation)
Stratovarius - Infinite
Tarot - Crows Fly Black
The Living End - everything pre-White Noise
Warmen - Japanese Hospitality
require 'spec_helper'
describe GamesController do
describe 'POST "create"' do
subject(:response) { post :create, params }
context 'valid parameters provided' do
let(:params) { { game: FactoryGirl.attributes_for(:game) } }
specify { expect { subject }.to change(Game, :count).by 1 }
RSpec::Matchers.define :assign_to do |variable|
chain :with do |value|
@value = value
end
match do |response|
if @value
assigns[variable] == @value
else
assigns.has_key?(variable)
@sevenseacat
sevenseacat / series_spec.rb
Last active December 18, 2015 12:59
Inconsistencies in using rspec's `expect` syntax. Does it take an argument or a block? In which circumstances does it take each? Why can't we all just get along!?
describe SeriesController do
describe 'GET "create"' do
subject { post :create, series: params }
context 'valid parameters provided' do
let(:params) { FactoryGirl.attributes_for :series }
# Using expect(subject) here leads to an error:
# NoMethodError: undefined method `call' for #<ActionController::TestResponse:0x007f03c4c3d470>
specify { expect { subject }.to change(Series, :count).by(1) }
class Product < ActiveRecord::Base
def self.supplied_within_states(*states)
# So you can pass either an array or a list of arguments to the method
states = states.flatten(1)
if states.include? 'all'
scoped
else
# Here be dragons! - RS 2013-05-20
# Ideally this query would be much simpler - something like: