Skip to content

Instantly share code, notes, and snippets.

View jessecurry's full-sized avatar

Jesse Curry jessecurry

View GitHub Profile
@jessecurry
jessecurry / routes.rb
Created February 3, 2014 23:11
Respond to a custom HTTP method in a Rails App
Example::Application.routes.draw do
# TRIFORCE /youcant
match :youcant, to: "youcant#triforce", via: :triforce
end
@jessecurry
jessecurry / chipotle.json
Last active December 28, 2015 08:29 — forked from agoodman/chipotle.json
Improved chipotle order.
{
"salad": {
"meat": "carnitas",
"beans": null,
"rice": true,
"addons": {
"salsa": ["hot"],
"sour_cream": false,
"cheese": false,
"guacamole": true,
@jessecurry
jessecurry / paperclip_migration.rake
Created August 13, 2013 21:51
Rake task for migrating paperclip attachments stored on S3 when you have to change your path.
namespace :paperclip_migration do
desc 'Migrate data'
task :migrate_s3 => :environment do
# Make sure that all of the models have been loaded so any attachments are registered
puts 'Loading models...'
Dir[Rails.root.join('app', 'models', '**/*')].each { |file| File.basename(file, '.rb').camelize.constantize }
# Iterate through all of the registered attachments
puts 'Migrating attachments...'
@jessecurry
jessecurry / gist:6168998
Created August 6, 2013 21:45
Semantic font definition usage example
headerLabel.font = FONT_ON_SCREEN_TEXT;
@jessecurry
jessecurry / Fonts.h
Created August 6, 2013 21:33
An example of semantic font definitions. Used to more easily adhere to (and update) a style guide.
// Base Fonts
#define FONT_GIRL_SCOUTS_SEMIBOLD(x) [UIFont fontWithName: @"Omnes_GirlScouts-Semibold" size: (x)]
#define FONT_GIRL_SCOUTS_MEDIUM(x) [UIFont fontWithName: @"Omnes_GirlScouts-Medium" size: (x)]
// Semantic Fonts
#define FONT_CELL_TEXT_LABEL FONT_GIRL_SCOUTS_MEDIUM(17.0)
#define FONT_CELL_DETAIL_TEXT_LABEL FONT_GIRL_SCOUTS_MEDIUM(14.0)
#define FONT_ON_SCREEN_TEXT FONT_GIRL_SCOUTS_MEDIUM(15.0)
#define FONT_ON_SCREEN_TEXT_SMALL FONT_GIRL_SCOUTS_MEDIUM(13.0)
@jessecurry
jessecurry / self-retain-cycle
Created June 19, 2013 18:07
Prevent the ARC retain cycle warning when using NSAssert.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Warc-retain-cycles"
NSAssert(FALSE, @"NSAssert uses self, which will cause a retain cycle warning under ARC");
#pragma clang diagnostic pop