Skip to content

Instantly share code, notes, and snippets.

View aaronrussell's full-sized avatar

Aaron Russell aaronrussell

View GitHub Profile
@aaronrussell
aaronrussell / Gemfile
Last active February 14, 2017 21:08
Authenticate PushType with Spree users and remove PushType users from admin UI
# Gemfile
# Selectively only require the parts of PushType we need
gem 'push_type_core', '~> 0.10.2'
gem 'push_type_api', '~> 0.10.2'
gem 'push_type_admin', '~> 0.10.2'
@aaronrussell
aaronrussell / compile.rb
Created October 28, 2015 15:37 — forked from havenwood/compile.rb
Little script using mruby to compile to self-executable
#!/usr/bin/env ruby
class Compiler
def initialize
@mruby_dir = '/Users/shannonskipper/.rubies/mruby'
sanity_check_argv
@file = ARGV.first.sub /.rb$/, ''
end
def run
@aaronrussell
aaronrussell / 1.terminal.sh
Last active August 29, 2015 14:27
Refresh embeds on discourse
cd /var/discourse
sudo ./launcher enter app
cd /var/www/discourse
rails c
@aaronrussell
aaronrussell / post-receive
Created April 15, 2015 08:40
Python gitolite post receive hook
#!/usr/bin/env python
import sys
import urllib, urllib2
import re
import os
import subprocess
from datetime import datetime
import simplejson as json

Keybase proof

I hereby claim:

  • I am aaronrussell on github.
  • I am aaronrussell (https://keybase.io/aaronrussell) on keybase.
  • I have a public key whose fingerprint is A5E8 8A17 8733 A3F8 34E9 A5DC D473 0945 D851 15F4

To claim this, I am signing this object:

@aaronrussell
aaronrussell / gist:3500393
Created August 28, 2012 16:47
rake cucumber
Using the default profile...
Feature: Password reset
In order to sign in even if I forgot my password
As a user
I want to reset my password
Background: # features/clearance/visitor_resets_password.feature:7
Given all emails are set up # features/step_definitions/email_steps.rb:1
PGError: ERROR: current transaction is aborted, commands ignored until end of transaction block

Every time I run the migrations, a particular migration fails. This is the error:

bundle exec rake db:migrate

.... a bunch of successful migrations, then...

rake aborted!
An error has occurred, all later migrations canceled:

Mysql2::Error: Unknown column 'meta_keywords' in 'field list': INSERT INTO pages (draft, meta_keywords, depth, link_url, lft, parent_id, meta_description, menu_match, rgt, show_in_menu, skip_to_first_child, custom_title_type, title, path, custom_title, deletable, created_at, browser_title, position, updated_at) VALUES (0, NULL, NULL, '/vehicle_manufacturers', 7, NULL, NULL, '^/vehicle_manufacturers(\/|\/.+?|)$', 8, 1, 0, 'none', 'Vehicle Manufacturers', NULL, NULL, 0, '2012-08-14 12:15:44', NULL, 2, '2012-08-14 12:15:44')

@aaronrussell
aaronrussell / jquery.tooltip.js
Created September 20, 2011 15:55
jQuery Tooltip Plugin
/**
* jQuery Tooltip Plugin
*@requires jQuery v1.2.6
* http://www.socialembedded.com/labs
*
* Copyright (c) Hernan Amiune (hernan.amiune.com)
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
@aaronrussell
aaronrussell / pagination_helper.rb
Created June 30, 2011 08:18
Nanoc pagination
module PaginationHelper
# The main pagination method, you should only need to call this
# Returns full HTML markup for pagination links
def pagination(page, pages, uri)
html, ul = [], []
html << pagination_position(page, pages)
if pages > 1
ul << pagination_previous_link(page, uri)
ul << pagination_page_links(page, pages, uri)
@aaronrussell
aaronrussell / background_noise_function.rb
Created March 5, 2011 18:24
Sass implementation of the Noisy jquery plugin: https://github.com/DanielRapp/Noisy
require "rubygems"
require "chunky_png"
require "base64"
module Sass::Script::Functions
def background_noise(c, noise = 0.5, opacity = 0.08, size = 200, mono = false)
# Convert SASS numbers to Ruby classes
noise = noise.to_s.to_f if noise.is_a? Sass::Script::Number