This file contains 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
#!/usr/bin/python | |
# Nicolas Seriot | |
# 2011-01-06 | |
# https://gist.github.com/768457 | |
""" | |
Input: path of an Objective-C project |
This file contains 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
#!/usr/bin/python | |
import sys | |
import os | |
from collections import defaultdict | |
import hashlib | |
theRoot = '/Volumes/Stuff/Files/' | |
theTrashFolder = '/Volumes/Stuff/Trash/' |
This file contains 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
// NSURLConnection wrapper | |
// like NSURLConnection, requires a runloop, callbacks happen in runloop that set up load | |
@interface LDURLLoader : NSObject | |
{ | |
NSURLConnection *_connection; | |
NSTimeInterval _timeout; | |
NSTimer *_timeoutTimer; | |
NSURLResponse *_response; | |
long long _responseLengthEstimate; | |
NSMutableData *_accumulatedData; |
This file contains 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
#import "CALayer_HitTestExtensions.h" | |
#import <objc/runtime.h> | |
static void *kHitMask; | |
@implementation CALayer (CALayer_HitTestExtensions) | |
- (NSUInteger)hitMask | |
{ |
This file contains 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
// | |
// NSNumber_Extensions.h | |
// TouchCode | |
// | |
// Created by Jonathan Wight on 12/8/11. | |
// Copyright (c) 2011 TouchCode. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> |
This file contains 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
// Find out where the frames will be with the "after" layout | |
1. Remove the "before" constraints | |
2. Add the "after" constraints | |
3. Call [window layoutIfNeeded], to force the frames to update | |
4. Grab the frames of all the views I want to animate and save them off | |
// Go back to what the user sees | |
5. Remove the "after" constraints | |
6. Add the "before" constraints | |
7. Call [window layoutIfNeeded], to force the frames to update |
This file contains 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
#!/usr/bin/python | |
import zipfile | |
import glob | |
import fnmatch | |
import sys | |
import json | |
import os | |
import Foundation |
This file contains 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
// Creating a lambda in C++ with variable type inferred automatically | |
auto someLambda = [](float w, int x, int y) { return(x); }; | |
// Creating a block in C/ObjC without the use of a typedef -- UGLY | |
int (^someBlock)(float, int, int) = ^(float w, int x, int y) { return(x); }; | |
// Creating a block in CPP/ObjCPP with variable type inferred automatically -- NOT TOO BAD | |
auto someBlock = ^(float w, int x, int y) { return(x); }; |
This file contains 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
self.startButton.rac_command = [RACCommand command]; | |
self.stopButton.rac_command = [RACCommand command]; | |
__unsafe_unretained id weakSelf = self; | |
id<RACSignal> tick = [[[[self.startButton.rac_command | |
map:^(id _) { | |
RTAFirstView *strongSelf = weakSelf; | |
// Map each start button click to a new signal that fires every second | |
// and stops when the stop button is clicked. | |
return [[RACSignal interval:1] takeUntil:strongSelf.stopButton.rac_command]; |
This file contains 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
#import <Foundation/Foundation.h> | |
// Adapted from http://stackoverflow.com/a/11068850 | |
/** | |
* @brief convert a hexidecimal string to a signed long | |
* will not produce or process negative numbers except | |
* to signal error. | |
* | |
* @param hex without decoration, case insensative. | |
* |
OlderNewer