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
CABasicAnimation* animation = [CABasicAnimation animationWithKeyPath:@"transform.rotation"]; | |
[animation setToValue:[NSNumber numberWithFloat:-M_PI/128]]; | |
[animation setFromValue:[NSNumber numberWithDouble:M_PI/128]]; | |
[animation setDuration:0.09]; | |
[animation setRepeatCount:NSUIntegerMax]; | |
[animation setAutoreverses:YES]; |
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
var mongoose = require('mongoose'), | |
Schema = mongoose.Schema, | |
Promise = mongoose.Promise, | |
mongooseAuth = require('mongoose-auth'), | |
UserSchema = new Schema({}, { strict: true }), | |
User; | |
UserSchema.plugin(mongooseAuth, { |
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
#import <Foundation/Foundation.h> | |
@interface TCMemoryDebugPrinter : NSObject | |
+ (Class)activateMemoryDebuggingFor:(Class)sourceClass; | |
@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
@interface NSObject (Cast) | |
+ (instancetype)cast:(id)from; | |
@end | |
@implementation NSObject (Cast) | |
+ (instancetype)cast:(id)from { | |
if ([from isKindOfClass:self]) { | |
return from; | |
} | |
return nil; |
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/sh | |
/Applications/Twitter.app/Contents/MacOS/Twitter & | |
sudo dtrace -q -p $! -n 'pid$target::free:entry /arg0 != 0/ { printf("%s\n", copyinstr(arg0)) }' 2> /dev/null | grep oauth |
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
extern void CGPathPrint(CGPathRef path, FILE* file); | |
CGPathPrint(path.CGPath, NULL); | |
Path 0xb44e380: | |
moveto (-12, 295) | |
lineto (115, 295) | |
lineto (108, -12) | |
lineto (235, -12) |
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
//Formats a string in which format specifiers look like %(key)@, similar to Python's %(key)s. | |
//Currently does not work with any other specifiers (i/d/u/x/f/g/e/s/c/C) or formatting guidance (space-padding, justification, etc.), and probably will never allow mixing positional and keyed format specifiers, just as Python doesn't. | |
- (NSString *) stringWithFormat:(NSString *)format values:(NSDictionary *)values { | |
NSRegularExpression *regularExpression = [NSRegularExpression regularExpressionWithPattern:@"%\\(([a-z_][a-z0-9_]*)\\)@" | |
options:NSRegularExpressionCaseInsensitive | |
error:NULL]; | |
NSMutableString *resultString = [NSMutableString stringWithCapacity:format.length | |
+ [[[values allValues] valueForKeyPath:@"@sum.length"] unsignedIntegerValue]]; | |
__block NSRange rangeSinceLastMatch = { 0, 0 }; |
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
# download imagesnap [http://iharder.sourceforge.net/current/macosx/imagesnap/] | |
# identify your video recording device | |
./imagesnap -l | |
# repeatedly take a snapshot | |
while :; do ./imagesnap -d "HD Pro Webcam C920" ~/Pictures/snapshots/`date +%H-%M-%S`.jpeg; sleep 58; done | |
# optional: resize | |
# WARNING - will overrite your files |
OlderNewer