Skip to content

Instantly share code, notes, and snippets.

View schof's full-sized avatar

Sean Schofield schof

  • Stedi
  • Washington, DC
View GitHub Profile
@schof
schof / gist:1de6a13d5f4d55f517ba
Last active December 27, 2015 00:13 — forked from al3xandru/gist:1169583
OmniFocus Generalized Bookmarklet
javascript:(function(){
var enc=encodeURIComponent,
w=window,
frames=w.frames,
d=document,
tn=w.getSelection?w.getSelection():(d.getSelection)?d.getSelection():(d.selection?d.selection.createRange().text:0),
pu=w.location.href,
isGMail=w.location.host.match(/mail\.google\.com/),
tt=pt=d.title,
subjSpans=d.getElementsByClassName("hP"),i,url;
@schof
schof / import.json
Last active December 19, 2015 11:59 — forked from BDQ/import.json
{
"message": "order:new",
"payload": {
"order": {
"channel": "Amazon",
"email": "test1@test.com",
"currency": "USD",
"line_items": [
{
"price": 19.99,
@schof
schof / products_controller_decorator.rb
Last active December 17, 2015 05:49
Simple controller override
Spree::Admin::ProductsController.class_eval do
# don't try and load data before import action either
before_filter :load_data, :except => [:index, :import]
def import
# do stuff
end
end
@schof
schof / migrations.rb
Last active December 17, 2015 03:28
Basic logic for recurring subscriptions. NOTE: Uses older version of Spree so it needs some tweaks for Spree 2.0
class CreateSubscriptions < ActiveRecord::Migration
def self.up
create_table :subscriptions do |t|
t.date :start_date
t.date :end_date
t.integer :duration
t.string :interval
t.string :state
t.references :user
t.references :variant
@schof
schof / Release.md
Last active December 17, 2015 01:30
Spree 2.0 Release Checklist

Stuff Needed for RC1

  • fix remaining broken translations
  • re-sync the i18n locales in spree_i18n (remove defunct keys, add new ones, etc.)
  • upgrade guide
  • updated release notes

Stuff Needed fof Final Release

@schof
schof / Gemfile
Created November 6, 2012 02:03 — forked from anonymous/Gemfile
source 'https://rubygems.org'
gem 'rails', '3.2.8'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'mysql2'
@schof
schof / gist:2628078
Created May 7, 2012 14:29
Restart Pow after DNS failure
#!/bin/bash
# Restarts Pow when DNS fails to resolve
lsof | grep 20560 | awk '{print $2}' | xargs kill -9
launchctl unload ~/Library/LaunchAgents/cx.pow.powd.plist
launchctl load ~/Library/LaunchAgents/cx.pow.powd.plist
@schof
schof / tax_rate_spec.rb
Created December 16, 2011 03:34
Latest tax rate specs
require 'spec_helper'
describe Spree::TaxRate do
context 'validation' do
it { should validate_presence_of(:tax_category_id) }
end
context "match" do
let(:zone) { Factory(:zone) }
@schof
schof / devise_hack.rb
Created March 2, 2011 14:38
Monkey Patch Devise
Devise::FailureApp.class_eval do
def http_auth?
return false
end
end
before(:each) do
@user = mock_model(User).as_null_object
end
let(:inventory_unit) { mock_model(InventoryUnit).as_null_object }
describe "GET index" do
let(:collection) { mock("collection") }
before { controller.stub :collection => collection }