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
// $ 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
@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` |
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
$ cat /var/folders/p2/ks11y6qj4kb2dyyl7n5rydcm0000gn/T/com.apple.mail.drag/\[cocoaheadsau\]\ CocoaHeads\ Sydney\ August\ –\ For\ Real\ this\ time\! | tr -dc '!' | wc -c | |
24 |
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
/Developer/usr/include/_locale.h | |
/Developer/usr/include/_structs.h | |
/Developer/usr/include/_types.h | |
/Developer/usr/include/_wctype.h | |
/Developer/usr/include/_xlocale.h | |
/Developer/usr/include/aio.h | |
/Developer/usr/include/alloca.h | |
/Developer/usr/include/apache2 | |
/Developer/usr/include/apache2/ap_compat.h | |
/Developer/usr/include/apache2/ap_config.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
#!/bin/env bash | |
packages=( | |
DevSDK.pkg | |
DeveloperToolsCLI.pkg | |
DeveloperToolsSystemSupport.pkg | |
gcc4.2.pkg | |
llvm-gcc4.2.pkg | |
clang.pkg | |
) |
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
// Usage example: | |
// input image: http://f.cl.ly/items/3v0S3w2B3N0p3e0I082d/Image%202011.07.22%2011:29:25%20PM.png | |
// | |
// UIImage *buttonImage = [UIImage ipMaskedImageNamed:@"UIButtonBarAction.png" color:[UIColor redColor]]; | |
// .h | |
@interface UIImage (IPImageUtils) | |
+ (UIImage *)ipMaskedImageNamed:(NSString *)name color:(UIColor *)color; | |
@end |
NewerOlder