Skip to content

Instantly share code, notes, and snippets.

@kellysutton
kellysutton / layervault_install.sh
Created June 19, 2013 21:49
Install the LayerVault Mac app with homebrew
brew tap phinze/homebrew-cask
brew install brew-cask
brew cask install layervault
@kellysutton
kellysutton / gist:5471922
Last active December 16, 2015 17:39
Magic sauce
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
kellysutton / gist:2050328
Created March 16, 2012 14:35
ActionMailer assets with hash-based asset hosting

In config/production.rb

  config.action_mailer.asset_host = "https://123123.cloudfront.net"

In config/initializers/mail_image_tag.rb

module ActionView
@kellysutton
kellysutton / newest.rb
Created November 20, 2011 21:13
So fresh and so new (new)
class Array
def newest
records = self.select{ |e| e.kind_of? ActiveRecord::Base }
records.sort do |a, b|
a.created_at <=> b.created_at
end
records.last
end
@kellysutton
kellysutton / BlipForm.html
Created August 19, 2011 17:29
Dynamically Generated Form
<div id="Placeholder"></div>
<script>
var myForm = new BLIP.Form({
target: "Placeholder",
action: "/episodes",
method: "POST",
inputs: [
{
name: "email",
@kellysutton
kellysutton / html5Form.html
Created August 19, 2011 16:53
HTML5 Forms
<style>
.ProFeature {
display: none;
}
</style>
<form action="/episodes" method="POST" data-is-pro="<%= user.pro %>">
<input type="email" name="email" />
<input type="email" name="alternate_email" class="ProFeature" disabled />
</form>
@kellysutton
kellysutton / LetUsAppend.js
Created August 17, 2011 21:00
Use jQuery for element construction
var createMyWrappedInput = function (defaultValue) {
var wrapper = $("<div class='Wrapper'></div>"),
input = $('<input type="text" />');
input.val(defaultValue);
wrapper.append(input);
return wrapper;
};
@kellysutton
kellysutton / joinThoseBros.js
Created August 17, 2011 20:55
Example with an Array.join()
var createMyWrappedInput = function (defaultValue) {
return [
'<div class="Wrapper">',
'<input type="text" value="' + defaultValue + '"/>',
'</div>'
].join("");
};
var createMyWrappedInput = function (defaultValue) {
var wrappedInput = "<div class='Wrapper'>";
wrappedInput += '<input type="text" value="' + defaultValue + '"/>';
wrappedInput += '</div>';
return wrappedInput;
};