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
WORKSPACE = "MyAwesomeProject.xcworkspace" | |
SCHEME = "MyAwesomeProjectScheme" | |
CONFIGURATION = debug | |
TARGET_BUILD_DIR = ./build | |
BINARY = $(TARGET_BUILD_DIR)/MyAwesomeProject.app | |
IPA = MyAwesomeProject.ipa | |
# fill in from https://testflightapp.com/api/doc/ | |
TF_API_TOKEN = '' | |
TF_TEAM_TOKEN = '' |
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
NSString *uuid = [[NSUserDefaults standardUserDefaults] stringForKey:@"CFUUID"]; | |
if (!uuid) { | |
CFUUIDRef cfuuid = CFUUIDCreate(NULL); | |
uuid = [(NSString *)CFUUIDCreateString(NULL, cfuuid) autorelease]; | |
[[NSUserDefaults standardUserDefaults] setValue:uuid forKey:@"CFUUID"]; | |
[[NSUserDefaults standardUserDefaults] synchronize]; | |
CFRelease(cfuuid); | |
} |
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
//Slow: | |
int r = (pixels[i] & 0x00FF0000 >> 16) * -1 + 255; | |
int b = (pixels[i] & 0x0000FF00 >> 8) * -1 + 255; | |
int g = (pixels[i] & 0x000000FF) * -1 + 255; | |
pixels[i] = r << 16 | b << 8 | g; | |
//Fast: | |
pixels[i] ^= 0x00FFFFFF; |
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
total=`sysctl hw.memsize | awk '{print $2}'` | |
total=`echo $total / 1024 | bc` | |
physmem=`top -l 1| grep PhysMem: | sed s/M/*1024/g` | |
#wired=` echo $physmem | awk '{print $2}' | bc` | |
#active=` echo $physmem | awk '{print $4}' | bc` | |
#inactive=`echo $physmem | awk '{print $6}' | bc` | |
used=` echo $physmem | awk '{print $8}' | bc` | |
free=` echo $physmem | awk '{print $10}' | bc` |
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
// | |
// ExternalViewController.m | |
// | |
// Created by William LaFrance. | |
// Public Domain | |
// | |
#import "ExternalViewController.h" | |
@interface ExternalViewController () |
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
Memory management in C | |
void *malloc(size_t size); | |
Allocates size bytes of memory | |
void *calloc(size_t count, size_t size); | |
Allocate count times size | |
void *realloc(void *ptr, size_t size); | |
malloc's size, copies memory, frees old pointer |
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 newClass = NSClassFromString(@"UINewClassThatYouCantHave"); | |
if (newClass) { | |
NSLog(@"We're on an iOS that has the new class"); | |
id newObject = [[newClass alloc] init]; | |
if ([self respondsToSelector:@selector(selectorThatUsesNewObject:)]) | |
[self performSelector:@selector(selectorThatUsesNewObject:) withObject:newObject]; | |
} else { | |
NSLog(@"Class doesn't exist!"); | |
} |
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
#include <stdio.h> | |
#include <stdint.h> | |
#include <stdlib.h> | |
struct SObject | |
{ | |
uint32_t retainCount; | |
void *buffer; | |
}; |
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
jruby-1.6.7.2 :014 > multiplier = 1.0 / 3.0 | |
=> 0.333333333333333 | |
jruby-1.6.7.2 :015 > multiplier * 3 | |
=> 1.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
# list largest files on your hard drive, down to a certain depth, ordered by size | |
find / -type f -maxdepth 3 -exec du {} \; | sort -n -r > ~/usage.txt |