Skip to content

Instantly share code, notes, and snippets.

@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;
};
@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 / 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 / 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 / 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 / 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 / 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 / my_serializer.rb
Last active December 20, 2015 02:39
ActiveModel::Serializer cache_digest-esque behavior
class PersonSerializer < ActiveModel::Serializer
def model_version
Digest::MD5.hexdigest(File.read(File.join(Rails.root, "app/serializers", "#{self.class.to_s.underscore}.rb")).gsub(/\s/,''))
end
end
@kellysutton
kellysutton / gist:6335882
Created August 25, 2013 19:49
rap genius offer
I have an incredible team I’m sure you’ve heard of in New York and looking for another Ruby engineer to join the team. I'm working with the founder of RapGenius, Tom Lehman, on this opportunity and have multiple openings for mid level to sr/principal/lead developers. I helped these guys staff 2 Ruby on Rails engineers, both from well-known companies, let me know if you’d be interested in checking them out.
They pinned down $15M from Ben Horowitz and have been getting a ton of attention. I would be interested in hearing your thoughts.
www.rapgenius.com
http://rapgenius.com/Marc-andreessen-why-andreessen-horowitz-is-investing-in-rap-genius-lyrics (Definitely check this one out)
http://news.ycombinator.com/item?id=4698010 and http://rapgenius.com/posts/Rap-genius-is-hiring
We raised $15M from Andreessen Horowitz to build the Internet Talmud™ (read more here: http://goo.gl/LKNHO).