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
[CATransaction begin]; | |
CATransition *transition = [CATransition animation]; | |
transition.type = kCATransitionFade; | |
transition.duration = animated ? 0.5f : 0.0f; | |
transition.fillMode = kCAFillModeForwards; | |
transition.removedOnCompletion = YES; | |
[[UIApplication sharedApplication].keyWindow.layer addAnimation:transition forKey:@"transition"]; | |
[[UIApplication sharedApplication] beginIgnoringInteractionEvents]; |
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 -framework Foundation -o unicode-is-hard-lets-go-shopping unicode-is-hard-lets-go-shopping.m && ./unicode-is-hard-lets-go-shopping | |
// 2013-03-01 17:56:56.132 unicode-is-hard-lets-go-shopping[3390:707] string1='café', string2='café', string1.length=4, string2.length=5, [string1 isEqualToString:string2]=NO | |
// 2013-03-01 17:56:56.134 unicode-is-hard-lets-go-shopping[3390:707] precomposedString1='café', precomposedString2='café', precomposedString1.length=4, precomposedString2.length=4, [precomposedString1 isEqualToString:precomposedString2]=YES | |
#import <Foundation/Foundation.h> | |
int main (int argc, const char * argv[]) { | |
@autoreleasepool { | |
NSString *string1 = [NSString stringWithUTF8String:"\x63\x61\x66\xC3\xA9\x00"]; | |
NSString *string2 = [NSString stringWithUTF8String:"\x63\x61\x66\x65\xCC\x81\x00"]; |
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
function convertDampingRatioResponseToStiffnessDamping(dampingRatio, response) { | |
let mass = 1 | |
let angularFrequency = (2 * Math.PI) / response | |
let stiffness = Math.pow(angularFrequency, 2) * mass | |
let damping = dampingRatio * (2 * Math.sqrt(stiffness * mass)) | |
return { mass: mass, stiffness: stiffness, damping: damping } | |
} | |
function convertMassStiffnessDampingToDampingRatioResponse(mass, stiffness, damping) { |
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
United States 143441 | |
Argentina 143505 | |
Australia 143460 | |
Belgium 143446 | |
Brazil 143503 | |
Canada 143455 | |
Chile 143483 | |
China 143465 | |
Colombia 143501 | |
Costa Rica 143495 |
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 | |
cat .gitignore | egrep -v "^#|^$" | while read line; do | |
if [ -n "$line" ]; then | |
OLD_IFS=$IFS; IFS="" | |
for ignored_file in $( git ls-files "$line" ); do | |
git rm --cached "$ignored_file" | |
done | |
IFS=$OLD_IFS | |
fi |
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 bash | |
# Get a sample dictionary here: | |
# http://labs.kitiyo.com/files/t9.dic | |
umask 077 | |
NUMN=/tmp/numn.$$ | |
trap "exit 1" HUP INT PIPE QUIT TERM | |
trap "rm -f $DICTN $NUMN" EXIT |
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 CSAccountTests | |
- (void)testGetAPIKeyWithValidCredentials { | |
[self testAsync:^{ | |
CSAPI* validCredentialsAPI; | |
validCredentialsAPI = [[[CSAPI alloc] initWithSiteURL:kCSTestsValidSiteURL | |
username:kCSTestsValidUsername | |
password:kCSTestsValidPassword] autorelease]; | |
[validCredentialsAPI getAPIKey:^(NSString* APIKey){ |
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 | |
previous_sha, current_sha, branch_checkout, _ = *ARGV | |
exit if branch_checkout == 0 || previous_sha == current_sha | |
begin | |
require 'pathname' | |
require 'fileutils' | |
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
/** | |
Prevent Xcode 4.1 from using 100% CPU due to a bug while attempting to | |
connect to a remote iOS device. | |
# 1. Compile the patch | |
$ gcc -lobjc -fobjc-gc -framework Foundation -bundle -o _patch NDVXcodeRemoteDevicePatch.m | |
# 2. Find the PID of Xcode | |
$ XcodePID=`pidof Xcode` |
NewerOlder