This file contains hidden or 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
[11:42:38] [william@home ~]$ cat ~/bin/gitstat | |
#!/bin/bash | |
echo "working: `git diff | grep ^\- | wc -l | tr -d ' '` deletions, `git diff | grep ^\+ | wc -l | tr -d ' '` insertions" | |
echo "staged: `git diff --cached | grep ^\- | wc -l | tr -d ' '` deletions, `git diff --cached | grep ^\+ | wc -l | tr -d ' '` insertions" |
This file contains hidden or 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
(self = super.init).foo = bar; |
This file contains hidden or 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 <stdio.h> | |
#import <stdlib.h> | |
typedef struct node_s { | |
struct node_s *next; | |
void *data; | |
} node_t; | |
typedef node_t list_t; | |
list_t * populateList() { |
This file contains hidden or 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
// writing | |
[object setValue:[NSData dataWithBytes:&rect length:sizeof(rect)] forKey:@"rect"]; | |
// reading | |
CGRect rect; | |
[[object valueForKey:@"rect"] getBytes:&rect]; |
This file contains hidden or 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 <CoreFoundation/CoreFoundation.h> | |
void DescribeCFObject(CFTypeRef cfobject) | |
{ | |
CFStringRef description = CFCopyDescription(cfobject); | |
printf("%s\n", CFStringGetCStringPtr(description, CFStringGetSystemEncoding())); | |
CFRelease(description); | |
} | |
const void *RetainCFObjectForCFArray(CFAllocatorRef allocator, const void *object) |
This file contains hidden or 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 <stdio.h> | |
int main(int argc, char **argv) { | |
void(^doHello)() = ^{ | |
printf("Hello\n"); | |
}; | |
doHello(); | |
return 0; | |
} |
This file contains hidden or 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 MsgSend | |
{ | |
/** | |
* Dynamically invoke a method, much like Objective-C message sending. | |
* | |
* This will ignore access restrictions, much like in Objective-C. | |
* Invoking private methods on other classes may cause harmful side-effects. | |
* | |
* @param object The object to "pass the message" to. If this is null, | |
* the result is always null. |
This file contains hidden or 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
// Hello world isn't hard. | |
jclass javaLangSystem = env->FindClass("java/lang/System"); | |
jfieldID javaLangSystemOut = env->GetStaticFieldID(javaLangSystem, "out", "Ljava/io/PrintStream;"); | |
jobject out = env->GetStaticObjectField(javaLangSystem, javaLangSystemOut); | |
jmethodID javaIoPrintStreamPrintln = env->GetMethodID(env->GetObjectClass(out), "println", "(Ljava/lang/String;)V"); | |
jstring helloJava = env->NewStringUTF("Hello Java!"); | |
env->CallVoidMethod(out, javaIoPrintStreamPrintln, helloJava); |
This file contains hidden or 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
// | |
// NSPredicate+KeyValue.h | |
// IncrementalAppnet | |
// | |
// Created by William LaFrance on 2/16/13. | |
// | |
#import <Foundation/Foundation.h> | |
@interface NSPredicate (KeyValue) |
This file contains hidden or 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
// | |
// AppUniqueIdentifier.h | |
// ReinstallationUdid | |
// | |
// Created by William LaFrance on 2/27/13. | |
// Copyright (c) 2013 William LaFrance. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> |