Skip to content

Instantly share code, notes, and snippets.

View jessecurry's full-sized avatar

Jesse Curry jessecurry

View GitHub Profile
@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
@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 / gist:6168998
Created August 6, 2013 21:45
Semantic font definition usage example
headerLabel.font = FONT_ON_SCREEN_TEXT;
@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 / 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 / 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 / angular-filter-bytes.js
Last active December 4, 2015 10:08 — forked from thomseddon/gist:3511330
Angular filter to display file sizes
app.filter('bytes', function() {
return function(bytes, precision) {
if (isNaN(parseFloat(bytes)) || !isFinite(bytes)) {
return '-';
}
if (typeof precision === 'undefined') {
precision = 1;
}
@jessecurry
jessecurry / BFParallaxImageView.h
Created August 26, 2014 20:23
Parallax NSImageView for OS X
//
// BFParallaxImageView.h
// bout-osx
//
// Created by Jesse Curry on 8/26/14.
// Copyright (c) 2014 Bout Fitness, LLC. All rights reserved.
//
#import <Cocoa/Cocoa.h>
@jessecurry
jessecurry / keybase.md
Created September 17, 2014 21:47
keybase.md

Keybase proof

I hereby claim:

  • I am jessecurry on github.
  • I am jessecurry (https://keybase.io/jessecurry) on keybase.
  • I have a public key whose fingerprint is AE69 C486 9CEC 9606 4C4E C394 B08C 3BFB C402 9463

To claim this, I am signing this object:

@jessecurry
jessecurry / jcKeypress.js
Created October 24, 2014 16:20
First pass for a keypress directive for Angular.js
.directive('jcKeypress', function () {
return {
template: '',
restrict: 'AE',
scope: {
keyCode: '@',
keyAction: '&'
},
link: function(scope, element, attrs) {
attrs.altKey = attrs.altKey || false;