Skip to content

Instantly share code, notes, and snippets.

View rpheath's full-sized avatar

Ryan Heath rpheath

View GitHub Profile

Keybase proof

I hereby claim:

  • I am rpheath on github.
  • I am rpheath (https://keybase.io/rpheath) on keybase.
  • I have a public key whose fingerprint is 5E40 EA52 A60E 8B8D 02BB A2BA AE6D ADC8 C7C8 8279

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am rpheath on github.
  • I am rpheath (https://keybase.io/rpheath) on keybase.
  • I have a public key ASBBwwBIcG4N7u8QQCiUP4iRWU49aUOYHPLNNBuq5c7Vigo

To claim this, I am signing this object:

@rpheath
rpheath / authlogic-to-devise.md
Last active December 30, 2020 14:35
Steps and troubleshooting tips when moving Authlogic to Devise.

How To: Authlogic to Devise

Step 1: Migration

  1. bin/rails g migration AuthlogicToDevise
  2. (see the file below for the actual migration, authlogic_to_devise.rb)
  3. bin/rake db:migrate

Step 2: Update Gemfile

  1. gem "devise", "~> 2.2.0"
  2. bundle install
@rpheath
rpheath / ML-upgrade-notes.md
Last active October 10, 2015 03:37
Mountain Lion 10.8 Upgrade Notes

Backups

The install will wipe out and reset a few things, most notably for developers:

  • /etc/apache2/httpd.conf (gets reset, not wiped)
  • /etc/php.ini (gets wiped)

You may want to backup those two files before upgrading to ML.


@rpheath
rpheath / autosave.js
Created August 22, 2012 01:34
Auto-saving
// Usage:
// $(function() { $(document).autosave(); });
(function($) {
// initialize the namespace with an empty timer
$.autosave = { timer: null };
// NOTE: all actionable methods below provide hooks that you can
// bind to as needed (both before/after hooks are triggered)
@rpheath
rpheath / article.rb
Created August 6, 2012 18:30
Link Validation
class Article < ActiveRecord::Base
# ...
def embedded_links
self.body_html.scan(/<a.+?href="(.+?)".+?/) if body_html
end
def has_links?
self.embedded_links.flatten.present?
end
@rpheath
rpheath / template.js
Created April 24, 2012 17:16
Template Caching
// handles caching and rendering templates
var Template = (function() {
// initialize private method container
var TemplateHandler = function() {};
// private methods
TemplateHandler.prototype = {
// used to hold the collection of
// key/value cached templates
templates: {},
@rpheath
rpheath / gemspec-usage.md
Created February 29, 2012 03:10 — forked from scharfie/gemspec-usage.md
test/spec/mini

Just install this in your apps like so:

gem 'test-spec-mini', :git => 'git://gist.github.com/1806986.git', :require => 'mini'

@rpheath
rpheath / validator.coffee
Created February 7, 2012 05:36
Client-Side Password Validator
# Playing around with CoffeeScript...
#####################################################################################
# Validator needs to inherit from Module class so we can support mixins
class Module
@include: (obj) ->
for key, value of obj
@::[key] = value
# -----------------------------------------------------------------------------------
development:
subdomain: development-subdomain
api_key: XXX
site_key: XXX
production:
subdomain: production-subdomain
api_key: XXX
site_key: XXX