This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// NSArray+CLinq.h | |
// | |
// Created by Casey Liss on 12/1/13. | |
// Copyright (c) 2013 Casey Liss. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> | |
typedef id(^CLSelector)(id source); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
expr -- (void)printf("[%s, %s]\n",(char *) object_getClassName(*(long*)($esp+4)), (char *) *(long *)($esp+8) ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// SGDeviceIdentifier.h | |
// Elements | |
// | |
// Created by Justin Williams on 9/28/12. | |
// Copyright (c) 2012 Second Gear. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static NSInteger NSJSONReadingFuckNSNulls = (1UL << 3); | |
@implementation NSJSONSerialization (FuckNulls) | |
+ (void)load { | |
Method originalMethod = class_getClassMethod(self, @selector(JSONObjectWithData:options:error:)); | |
IMP swizzledImplementation = imp_implementationWithBlock([^id (id _self, NSData *_data, NSJSONReadingOptions _opt, NSError **_error){ | |
NSInputStream *stream = [NSInputStream inputStreamWithData:_data]; | |
[stream open]; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// OLD AND BUSTED | |
// | |
if ([self.zoomingDelegate respondsToSelector:@selector(zoomingWindow:didZoomOutViewController:)] == YES) | |
{ | |
// Do something important. | |
} | |
// |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl https://raw.github.com/gist/3998177/0ac991d732fbfba9f3d8cfd14b861461ef2d9393/2.0.0-preview1 > /tmp/2.0.0-preview1 | |
rbenv install /tmp/2.0.0-preview1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// CHTCenteredCellLayout.m | |
// | |
// Created by Steve Streza on 10/25/12. | |
// Use however you like. | |
// | |
#import "CHTCenteredCellLayout.h" | |
@implementation CHTCenteredCellLayout |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Admin::DelayedJobsController < AdminController | |
# GET /admin/delayed_jobs | |
def index | |
@delayed_jobs = Delayed::Backend::Mongoid::Job.desc(:created_at) | |
.paginate :page => params[:page], :per_page => 20 | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Optional CSS for themes that don't wrap the pre tag properly */ | |
div.github-gist-block pre { | |
background-color: #F5F5F5; | |
border: 1px solid rgba(0, 0, 0, 0.15); | |
border-radius: 4px 4px 4px 4px; | |
display: block; | |
font-size: 13px; | |
line-height: 20px; | |
margin: 0 0 10px; | |
padding: 9.5px; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface NSObject (Cast) | |
+ (instancetype)cast:(id)from; | |
@end | |
@implementation NSObject (Cast) | |
+ (instancetype)cast:(id)from { | |
if ([from isKindOfClass:self]) { | |
return from; | |
} | |
return nil; |