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
desc 'Remove unused images' | |
task :clean_assets do | |
require 'set' | |
all = Set.new | |
used = Set.new | |
unused = Set.new | |
# White list | |
used.merge %w{Icon Icon-29 Icon-50 Icon-58 Icon-72 Icon-114} |
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
- (UIImage *) loadMapImage { | |
const int MINZOOM = 13; | |
const int MAXZOOM = 17; | |
// TODO: calculate these from list of cycle hire locations | |
const float MINLAT = 51.483145; //minimum and max lattitude in degrees | |
const float MAXLAT = 51.542138; | |
const float MINLONG = -0.2242237; //min and max longitutde in degrees | |
const float MAXLONG = -0.002275; | |
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> | |
// clang -g -Wall -framework Foundation -o atomic atomic.m | |
// gcc -g -Wall -framework Foundation -o atomic atomic.m | |
@interface Blah : NSObject | |
@property (assign, NS_NONATOMIC_IOSONLY) NSInteger frobnozzle; | |
@property (assign, ) NSInteger commaAtEnd; | |
// @property (, assign) NSInteger commaAtBeginning; // Syntax error | |
@property (atomic, assign) NSInteger blah; // complains in gcc |
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
/* clang -fobjc-arc -framework Foundation -framework CoreServices dict.m -o dict */ | |
#import <Foundation/Foundation.h> | |
#import <CoreServices/CoreServices.h> | |
int main(int argc, const char * argv[]) | |
{ | |
@autoreleasepool { | |
if(argc < 2) | |
{ |
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
void *UIKit = dlopen([[[NSBundle bundleForClass:[UIApplication class]] executablePath] fileSystemRepresentation], RTLD_LAZY); | |
CGFloat (*UIAnimationDragCoefficient)(void) = (CGFloat (*) (void)) dlsym(UIKit, "UIAnimationDragCoefficient"); | |
DLog(@"coefficient is %f", UIAnimationDragCoefficient ? UIAnimationDragCoefficient() : 1.f); |
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
[[NSNotificationCenter defaultCenter] addObserverForName:nil object:nil queue:nil usingBlock:^(NSNotification *note) { | |
NSLog(@"Catch-All: %@", note); | |
}]; | |
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 <mach/mach_host.h> | |
int get_platform_memory_limit() | |
{ | |
mach_port_t host_port; | |
mach_msg_type_number_t host_size; | |
vm_size_t pagesize; | |
host_port = mach_host_self(); | |
host_size = sizeof(vm_statistics_data_t) / sizeof(integer_t); |
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
let path = UIBezierPath() | |
let radius : CGFloat = 4 | |
let topRightStartAngle = -CGFloat(M_PI_2) | |
let topRightEndAngle : CGFloat = 0.0 | |
let bottomRightStartAngle : CGFloat = 0.0 | |
let bottomRightEndAngle : CGFloat = -(CGFloat(M_PI) * 3) / 2 | |
let bottomRightCenterPoint = CGPoint(x: CGRectGetWidth(self.bounds) - radius, y: CGRectGetHeight(self.bounds) - radius) |
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
APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}" | |
# This script loops through the frameworks embedded in the application and | |
# removes unused architectures. | |
find "$APP_PATH" -name '*.framework' -type d | while read -r FRAMEWORK | |
do | |
FRAMEWORK_EXECUTABLE_NAME=$(defaults read "$FRAMEWORK/Info.plist" CFBundleExecutable) | |
FRAMEWORK_EXECUTABLE_PATH="$FRAMEWORK/$FRAMEWORK_EXECUTABLE_NAME" | |
echo "Executable is $FRAMEWORK_EXECUTABLE_PATH" |
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
/// Translation of [Peter Norvig's spell checker](http://norvig.com/spell-correct.html) into Swift 3. | |
/// Sample input corpus [here](http://norvig.com/big.txt) | |
/// Swift 2 version: https://gist.github.com/airspeedswift/6d8c9d95f0d812f58be3 | |
import Foundation // purely for IO, most things done with Swift.String | |
/// Given a word, produce a set of possible alternatives with | |
/// letters transposed, deleted, replaced or rogue characters inserted | |
func edits(word: String) -> Set<String> { | |
if word.isEmpty { return [] } |
OlderNewer