Skip to content

Instantly share code, notes, and snippets.

@diabolo
diabolo / debug_steps.rb
Created September 13, 2012 08:40
Cucumber step helper that uses coderay to peek at html.
require 'coderay'
module DebugStepHelper
def peek
output = CodeRay.scan(page.body, :html).term
print '-- peeking at body'
@diabolo
diabolo / 01-domain_trip.rb
Created November 16, 2012 14:00 — forked from krisleech/01-domain_trip.rb
domain and persistence
class Domain::Trip
include Virtus
include ActiveModel::Validations
include ActiveModel::Conversion
extend ActiveModel::Naming
attribute :id
attribute :name
attribute :sections, Array[Section], :default => []
@diabolo
diabolo / stacktrace.md
Created August 7, 2013 12:40
Stack trace showing how Cucumber loads multi_json
Users/andy/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/json/common.rb:155:in `parse': uninitialized constant JSON::Parser (NameError)
    from /Users/andy/.rvm/gems/ruby-2.0.0-p247@global/gems/multi_json-1.7.8/lib/multi_json/adapters/json_common.rb:16:in `load'
    from /Users/andy/.rvm/gems/ruby-2.0.0-p247@global/gems/multi_json-1.7.8/lib/multi_json/adapter.rb:19:in `load'
    from /Users/andy/.rvm/gems/ruby-2.0.0-p247@global/gems/multi_json-1.7.8/lib/multi_json.rb:118:in `load'
    from /Users/andy/.rvm/gems/ruby-2.0.0-p247@h2/gems/gherkin-2.12.0/lib/gherkin/i18n.rb:14:in `<class:I18n>'
    from /Users/andy/.rvm/gems/ruby-2.0.0-p247@h2/gems/gherkin-2.12.0/lib/gherkin/i18n.rb:6:in `<module:Gherkin>'
    from /Users/andy/.rvm/gems/ruby-2.0.0-p247@h2/gems/gherkin-2.12.0/lib/gherkin/i18n.rb:5:in `<top (required)>'
    from /Users/andy/.rvm/gems/ruby-2.0.0-p247@h2/gems/gherkin-2.12.0/lib/gherkin/lexer/i18n_lexer.rb:2:in `require'

from /Users/andy/.rvm/gems/ruby-2.0.0-p247@h

@diabolo
diabolo / gist:7223268
Created October 29, 2013 21:49
Rails query question
Reasonably complex query using ActiveRecord
I have the following tables
Agents
------
id name
Clients
-------
@diabolo
diabolo / aplay -l
Last active September 14, 2015 21:37
Disconnect issue with USB Audio - xHCI xhci_drop_endpoint called with disabled ep ffff88042763d280
**** List of PLAYBACK Hardware Devices ****
card 0: PCM2702 [Burr-Brown Japan PCM2702], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: HDMI [HDA Intel HDMI], device 3: HDMI 0 [HDMI 0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: HDMI [HDA Intel HDMI], device 7: HDMI 1 [HDMI 1]
Subdevices: 1/1
Subdevice #0: subdevice #0
//
// Grid Columns
//
// A mixin to help make Foundation's grid-column mixin easier
// to use when specifying multiple media quries/screen sizes
@mixin grid-columns(
// Mobile First Media Queries
$small-up-screens: false,
$medium-up-screens: false,
16:48:41 admin:~
ubuntu:-> sudo dokku ps:rebuild production
-----> Cleaning up...
-----> Building production from buildstep...
-----> Adding BUILD_ENV to build environment...
-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.1.8
-----> Installing dependencies using 1.7.12