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
class NaNClass {} | |
let NaN = NaNClass() | |
@infix func == (n1: NaNClass, n2: NaNClass) -> Bool { | |
return false | |
} | |
@infix func != (n1: NaNClass, n2: NaNClass) -> Bool { | |
return true | |
} |
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/env ruby | |
require 'tempfile' | |
def main | |
if needs_uncrustify? | |
puts "Could not find `uncrustify` on the path. Try `brew install uncrustify`." | |
exit 1 | |
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
(main)> "test".tainted? | |
=> false | |
(main)> y = ENV["HOME"] | |
=> "/Users/jonathan/Library/Application Support/iPhone Simulator/6.1/Applications/B44BDE1C-A9FC-430F-B318-4093FD6BC65B" | |
(main)> y.tainted? | |
=> true |
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
sudo defaults write /Library/Preferences/com.apple.windowserver DisplayResolutionEnabled -bool YES; | |
sudo defaults delete /Library/Preferences/com.apple.windowserver DisplayResolutionDisabled; | |
// by the way, you need to logout and log back in for this to take effect. Or at least that's what | |
// Quartz Debug says. Who knows, maybe it's lying? | |
// P.S. Go to [Apple menu --> System Preferences --> Displays --> Display --> Scaled] after logging | |
// back in, and you'll see a bunch of "HiDPI" resolutions in the list to choose from. |
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
@implementation SomeGenerater | |
- (NSArray *)generateAThousandRandomStrings | |
{ | |
NSMutableArray *strings = [[NSMutableArray alloc] initWithCapacity:1000]; | |
for (int count = 0; count < 1000; count++) { | |
int length = arc4random_uniform(10) + 4; | |
unichar buf[length]; |
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
(* | |
Running this script will cause Instruments to become active | |
and switch from the Script view (where you edit your UIAutomation script) | |
to the Editor Log view (where you see the logs of executing those scripts) | |
or vice versa. | |
*) | |
-- JW: This block only needs to be executed once, and can then be removed. | |
-- I don't know if leaving it in might cause a performance hit; |
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 "MPAppDelegate.h" | |
@interface MPAppDelegate() | |
@property (strong, nonatomic) UIView *wildView; | |
@property (strong, nonatomic) UIViewController *viewController; | |
@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
// Based on this discussion: | |
// https://twitter.com/listrophy/statuses/251074683594747904 | |
// To setup: | |
// Create an application that has a tableView with a couple cells in it, one of | |
// which has the "coffee" in it's label | |
var target = UIATarget.localTarget(); | |
var app = target.frontMostApp(); | |
var window = app.mainWindow(); |
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
gem "mongo" | |
gem "bson_ext" | |
gem "mongoid" |
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/env ruby | |
ioreg = `ioreg -w 0 -rc IOUSBDevice -k SupportsIPhoneOS` | |
device_uuid = ioreg[/"USB Serial Number" = "([0-9a-z]+)"/] && $1 | |
if device_uuid | |
puts device_uuid | |
else | |
puts "No device detected." | |
exit 1 |
NewerOlder