Skip to content

Instantly share code, notes, and snippets.

Evan Cordell ecordell

Block or report user

Report or block ecordell

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ecordell
ecordell / test
Created Mar 2, 2016
Wrapper script for Dredd
View test
#!/usr/bin/env bash
set -e
export BASE_URL=${BASE_URL:-http://example.com}
babel hooks --out-dir compiled-hooks --source-maps inline
# Handle passing in specific file patterns
if [[ $# == 0 ]] || [[ $1 == -* ]]; then
View keybase.md

Keybase proof

I hereby claim:

  • I am ecordell on github.
  • I am ecordell (https://keybase.io/ecordell) on keybase.
  • I have a public key whose fingerprint is 9ECB B4A7 D86D 628C C643 4131 4630 B401 B328 E6FD

To claim this, I am signing this object:

@ecordell
ecordell / encrypted_caveats.py
Last active Aug 29, 2015
Encrypted first party caveats
View encrypted_caveats.py
from pymacaroons import Macaroon, Verifier
from pymacaroons.field_encryptors import SecretBoxEncryptor
# Create a macaroon
m = Macaroon(
location='http://mybank/',
identifier='we used our secret key',
key='this is our super secret key; only we should know it'
)
View gist:1140788
class AddCitierViewsToLandscape < ActiveRecord::Migration
def self.up
remove_column :landscapes, :created_at
remove_column :landscapes, :updated_at
rename_column(:photos, :inheritance_column_name, :type)
create_citier_view(Landscape)
end
def self.down
add_column :landscapes, :updated_at, :timestamp
View images_controller.rb
class ImagesController < ApplicationController
# GET /images
# GET /images.json
def index
@imageable = find_imageable
@images = @imageable.images
respond_to do |format|
format.html # index.html.erb
format.json { render :json => @images }
end
View development.log
Started POST "/landscapes" for 127.0.0.1 at 2011-07-22 11:07:18 -0500
Processing by LandscapesController#create as JSON
Parameters: {"landscape"=>{"id"=>0, "name"=>"Newscape", "city"=>"Fun city", "state"=>"LA", "zip"=>"71457", "images_attributes"=>[{"id"=>0, "image_data"=>"Im a bunch of image data image data image data", "is_thumbnail"=>1}], "address1"=>"Cool place"}}
SQL (61.9ms) SHOW TABLES[
Image Load (0.3ms) SELECT `images`.* FROM `images` WHERE `images`.`id` IN (0) AND (`images`.imageable_id = 0 AND `images`.imageable_type = 'Landscape')
Completed in 242ms
ActiveRecord::RecordNotFound (Couldn't find Image with ID=0 for Landscape with ID=0):
app/controllers/landscapes_controller.rb:44:in `new'
app/controllers/landscapes_controller.rb:44:in `create'
View subscription
class Subscription < Base
def self.find_by_customer_reference(reference)
customer = Customer.find_by_reference(reference)
find(:first, :params => {:customer_id => customer.id})
end
# Strip off nested attributes of associations before saving, or type-mismatch errors will occur
def save
self.attributes.delete('customer')
self.attributes.delete('product')
You can’t perform that action at this time.