Skip to content

Instantly share code, notes, and snippets.


Kelly Sutton kellysutton

View GitHub Profile
View butForWhyPlusEquals.js
var createMyWrappedInput = function (defaultValue) {
var wrappedInput = "<div class='Wrapper'>";
wrappedInput += '<input type="text" value="' + defaultValue + '"/>';
wrappedInput += '</div>';
return wrappedInput;
kellysutton / joinThoseBros.js
Created Aug 17, 2011
Example with an Array.join()
View joinThoseBros.js
var createMyWrappedInput = function (defaultValue) {
return [
'<div class="Wrapper">',
'<input type="text" value="' + defaultValue + '"/>',
kellysutton / LetUsAppend.js
Created Aug 17, 2011
Use jQuery for element construction
View LetUsAppend.js
var createMyWrappedInput = function (defaultValue) {
var wrapper = $("<div class='Wrapper'></div>"),
input = $('<input type="text" />');
return wrapper;
View html5Form.html
.ProFeature {
display: none;
<form action="/episodes" method="POST" data-is-pro="<%= %>">
<input type="email" name="email" />
<input type="email" name="alternate_email" class="ProFeature" disabled />
kellysutton / BlipForm.html
Created Aug 19, 2011
Dynamically Generated Form
View BlipForm.html
<div id="Placeholder"></div>
var myForm = new BLIP.Form({
target: "Placeholder",
action: "/episodes",
method: "POST",
inputs: [
name: "email",
kellysutton / newest.rb
Created Nov 20, 2011
So fresh and so new (new)
View newest.rb
class Array
def newest
records ={ |e| e.kind_of? ActiveRecord::Base }
records.sort do |a, b|
a.created_at <=> b.created_at
kellysutton / gist:2050328
Created Mar 16, 2012
ActionMailer assets with hash-based asset hosting
View gist:2050328

In config/production.rb

  config.action_mailer.asset_host = ""

In config/initializers/mail_image_tag.rb

module ActionView
View gist:5471922
NSString *pathToRelaunch = [host bundlePath];
if ([[updater delegate] respondsToSelector:@selector(pathToRelaunchForUpdater:)])
pathToRelaunch = [[updater delegate] pathToRelaunchForUpdater:updater];
NSString *relaunchToolPath = [relaunchPath stringByAppendingPathComponent: @"/Contents/MacOS/finish_installation"];
[NSTask launchedTaskWithLaunchPath: relaunchToolPath arguments:[NSArray arrayWithObjects:[host bundlePath], pathToRelaunch, [NSString stringWithFormat:@"%d", [[NSProcessInfo processInfo] processIdentifier]], tempDir, relaunch ? @"1" : @"0", nil]];
[NSApp terminate:self];
kellysutton /
Created Jun 19, 2013
Install the LayerVault Mac app with homebrew
brew tap phinze/homebrew-cask
brew install brew-cask
brew cask install layervault
kellysutton / my_serializer.rb
Last active Dec 20, 2015
ActiveModel::Serializer cache_digest-esque behavior
View my_serializer.rb
class PersonSerializer < ActiveModel::Serializer
def model_version
Digest::MD5.hexdigest(, "app/serializers", "#{self.class.to_s.underscore}.rb")).gsub(/\s/,''))
You can’t perform that action at this time.