Skip to content

Instantly share code, notes, and snippets.

View aaronrussell's full-sized avatar

Aaron Russell aaronrussell

View GitHub Profile
@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
@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 / 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'
# Taken from http://frst.in/~8r
# Configuration
set :application, "your.domain.com"
set :deploy_to, "/var/www/app"
set :repository, "git@github.com:username/project.git"
set :branch, "master"
set :user, "username"
# Additional SCM settings
@aaronrussell
aaronrussell / _contrast_mixin.scss
Created January 15, 2011 16:33
Sass function and mixin for setting contrasting background and foreground colors
$contrasted-default-dark: #000;
$contrasted-default-light: #fff;
@mixin contrasted($bg, $dark:$contrasted-default-dark, $light:$contrasted-default-light){
background-color: $bg;
color: get_contrast_yiq($bg, $dark, $light);
}
@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 / 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 / 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 / jquery.mobile.event.js
Created December 16, 2010 13:36
Slightly modified version of jQuery Mobile's event handlers so can be used standalone without the rest of the framework
/*
* jQuery Mobile Framework : events
* Copyright (c) jQuery Project
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*/
(function($, undefined ) {
$.extend( $.support, {
orientation: "orientation" in window,