Skip to content

Instantly share code, notes, and snippets.

@fidothe
fidothe / action.rb
Created March 18, 2015 16:05
poss other approach to apps loading problem
require 'api/application'
module Api
module Controllers
module Urls
class Add
include Api::Action
def call(params)
...
@fidothe
fidothe / eg_spec.rb
Created March 18, 2015 15:56
Approaching App Controller load problem
require 'spec_helper'
require_relative '../../../../apps/api/application'
RSpec.describe "Api::Controllers::Stuff::Create" do
let(:action) { Api::Controllers::Stuff::Create.new }
before(:all) do
Api::Application.preload!
end
@fidothe
fidothe / my_spec.rb
Created March 18, 2015 09:37
transaction-wrapped specs for Lotus::Model
require 'spec_helper'
RSpec.describe MyRepository, :db do
it "will be rolled back after completion" do
MyRepository.create(MyEntity.new)
expect(MyRepository.all.size).to eq(1)
end
it "will also be rolled back" do
MyRepository.create(MyEntity.new)
@fidothe
fidothe / gist:39d4ef9b8d84f8ddde77
Created March 18, 2015 09:14
Use PG JSON datatype with Lotus::Model (hacky hacky)
require 'lotus/model'
require 'json'
module Lotus::Model::Mapping::Coercions
def self.JSON(arg)
return nil if arg.nil?
case arg
when String
JSON.parse(arg)
else
@fidothe
fidothe / actual.txt
Created October 30, 2014 17:28
escaping double quotes in XSLT
\hi\
@fidothe
fidothe / .ruby-version
Last active August 29, 2015 14:06
Capybara CSS / XPath selector spec problem
2.1.2

Keybase proof

I hereby claim:

  • I am fidothe on github.
  • I am fidothe (https://keybase.io/fidothe) on keybase.
  • I have a public key whose fingerprint is FA58 96E6 EE8E 6FD8 483C 6AE9 2EDA FDD2 5AB8 38C2

To claim this, I am signing this object:

@fidothe
fidothe / broken.rb
Created August 1, 2013 14:06
Inchworms weirdness
require 'sinatra/base'
require 'rack/test'
class Silly
include Rack::Test::Methods
def app
Sinatra.new do
get '/', provides: :xml do
p env
@fidothe
fidothe / index.html
Last active December 16, 2015 04:39
demonstrate d3.behavior.zoom tap-eating
<html>
<head>
<title>tap eating</title>
</head>
<body>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script>
var width = 960,
height = 500;
@fidothe
fidothe / Gemfile
Created April 8, 2013 08:50
Illustrating problem with VCR 2.4.0 and Cucumber 1.2.4. Run with `bundle exec cucumber .`
source "http://rubygems.org/"
gem 'vcr', '2.4.0'
gem 'cucumber', '1.2.4'
gem 'webmock', '1.11.0'