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
#!/bin/bash | |
## Install Java Development Kit (JDK) without all the junk | |
# Strips the non-jdk stuff (Updater, Applet, Web Start, file associations) out of the installer. | |
# NB: this also removes the pre-installation checks and will install the JDK unconditionally | |
# to /Library/Java/JavaVirtualMachines/ with possible but unlikely dire consequences | |
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
# Country code lookup using offline quadtree generated by Yggdrasil. | |
# https://github.com/leonardvandriel/Yggdrasil | |
# This Ruby script can be used to determine the ISO 3166 country at a given | |
# WGS 84 coordinate. Lookup is based on quadtree data stored in the remainder | |
# of this file. This data can be compressed to under 20 KB, while providing | |
# lookup accuracy under 40 km. | |
# License: BSD | |
# Author: Leonard van Driel, 2013 | |
require 'json' |
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
// ImagePreloadingViewController - An iOS view controller for trying out different | |
// UIImage preloading strategies. Results for 1 MB png on iPhone 4S: | |
// - No preload: drawing the image right away (80 ms) | |
// - Header preload: getting the width (10 ms) and then drawing (100 ms) | |
// - Data preload: getting the data (110 ms) and then drawing (75 ms) | |
// - Draw preload: drawing it once (100 ms) and then again (20 ms) | |
// In short: preload a UIImage by drawing it. | |
// License: BSD | |
// Author: Leonard van Driel, 2012 |
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
// A HockeyApp delegate class. | |
// License: Public Domain | |
// Author: Leonard van Driel, 2012 | |
#import <HockeySDK/HockeySDK.h> | |
@interface NWHockeyChief : NSObject <BITHockeyManagerDelegate, BITUpdateManagerDelegate, BITCrashManagerDelegate> | |
+ (NWHockeyChief *)shared; | |
+ (void)setup; | |
@end |
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
// NWURLConnection - an NSURLConnectionDelegate based on blocks with cancel. | |
// Similar to the `sendAsynchronousRequest:` method of NSURLConnection, but | |
// with `cancel` method. Requires ARC on iOS 6 or Mac OS X 10.8. | |
// License: BSD | |
// Author: Leonard van Driel, 2012 | |
@interface NWURLConnection : NSObject<NSURLConnectionDelegate> | |
@property (nonatomic, strong) NSURLRequest *request; | |
@property (nonatomic, strong) NSOperationQueue *queue; |
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
// A Minimal PonyDebugger setup in Objective-C | |
// Add these lines to application:didFinishLaunchingWithOptions: and add the | |
// PonyDebugger and SocketRocket libs/frameworks to your project. Read the | |
// Quick Start at https://github.com/square/PonyDebugger#quick-start | |
// For on-device debugging, use `ponyd serve -i 0.0.0.0` and replace `localhost`. | |
// Author: Leonard van Driel, 2012 | |
#if DEBUG | |
PDDebugger *debugger = (PDDebugger *)[NSClassFromString(@"PDDebugger") defaultInstance]; | |
[debugger connectToURL:[NSURL URLWithString:@"ws://localhost:9000/device"]]; |
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
// Objective-C methods for Base64 conversion between NSString and NSData. | |
// Note: these do not support trailing '=' characters. | |
// License: Public Domain | |
// Author: Leonard van Driel, 2012 | |
static unsigned char toBase64String[65] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; | |
static unsigned char toBase64Data[256] = { | |
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, | |
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, |
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
// Objective-C methods for percent-escaping NSString, for use in NSURL. | |
// This approach does full escaping, instead of the 'smart' escaping that | |
// is provided by [NSString stringByReplacingPercentEscapesUsingEncoding:]. | |
// License: Public Domain | |
// Author: Leonard van Driel, 2012 | |
@implementation NSString (EscapeForURL) | |
- (NSString *)escapeForURL | |
{ |
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
// Objective-C method for composing a HTTP multipart/form-data body. | |
// Provide parameters and data in a NSDictionary. Outputs a NSData request body. | |
// License: Public Domain | |
// Author: Leonard van Driel, 2012 | |
@interface MultipartExample @end | |
@implementation MultipartExample | |
+ (void)exampleUsageUploadImage |
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
# Configuration tips when fighting Xcode - Build settings that build | |
# Starting from a fresh Xcode project, setting these on the project's build | |
# settings should suffice. Also put all libs and frameworks in the Frameworks | |
# dir and make sure included workspace header files are set to 'Public'. | |
# Author: Leonard van Driel, 2012 | |
Other Linker Flags: -ObjC | |
Public Headers Folder Path: ../../Headers | |
Framework Search Paths: "$(SRCROOT)/Frameworks" | |
Header Search Paths: "$(SRCROOT)/Frameworks"/** $(BUILT_PRODUCTS_DIR)/../../Headers |
NewerOlder