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;
#!/bin/bash
# A simple script to backup an organization's GitHub repositories.
GHBU_BACKUP_DIR=${GHBU_BACKUP_DIR-"github-backups"} # where to place the backup files
GHBU_ORG=$GHBU_ORG # the GitHub organization whose repos will be backed up
GHBU_API=${GHBU_API-"https://api.github.com"} # base URI for the GitHub API
GHBU_GITHOST="github.com" # the GitHub hostname (see comments)
# I recommend using an API token so it is easily trackable and removable.
# Note that you MUST have SSH keys for a user with the access to all repos set up
@schof
schof / gist:2cfc8989d2a37e9a34f1
Created February 8, 2015 01:59
Order Number Generator
# Current time in hex (saves a few chars)
n = Time.now.to_i.to_s(16)
# Add some more random digits and convert to base24 (more entropy w/minimal chars)
n += rand(9999).to_s(24)
# Make sure the whole thing is exactly 10 chars
n.ljust(10).gsub(" ", "0")
# Convert to upcase
@schof
schof / line_items.json
Created April 2, 2014 18:44
Same line items
"line_items": [
{
"product_id": "0300385BLK00M",
"name": "eve dress",
"quantity": 1,
"price": 198,
"image_url": "https://thereformation.com/rcms/media/3964/resize?size=60x60&tags=clp",
"properties": {
"color": "Black",
"size": "XS"
@schof
schof / gist:9711306
Created March 22, 2014 17:41
Sample /add_order response
{"request_id":"52f367367575e449c3000001","summary":"Order created in ShipStation: 90833246","order":{"id":"R154085346","shipstation_id":90833246}}
@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'