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
UIView *view = [[UIView alloc] init]; | |
NSData *objData = [NSData dataWithBytes:(__bridge const void *)(view) length:malloc_size(view)]; | |
NSLog(@"Object contains %@", objData); | |
/* | |
Code via http://mikeash.com/pyblog/friday-qa-2009-03-13-intro-to-the-objective-c-runtime.html | |
Output: | |
Object contains <bc8d7f00 603f6507 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 200000c0 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000> |
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
git config --get remote.origin.url | sed 's#^[^:]*.\([^.]*\)\.git#http://github.com/\1#' | xargs open |
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/ruby | |
def sortProperties(lines) | |
props = Hash.new | |
lines.each {|line| | |
props[line.gsub(/@.+?(\w+?);[^;]*?$/, "\\1")] = line | |
} | |
sortedKeys = props.keys.sort | |
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
+---------------+--------------------------+-------------------------+------------------------+ | |
| | 13" MacBook Air | 15" MacBook Pro | 15" Retina MacBook Pro | | |
| | $2450 | $2790 | $2750 | | |
+===============+==========================+=========================+========================+ | |
| CPU | 2.0 Dual Core i7 $1500 | 2.3 Quad Core i7 $1800 | 2.3 Quad Core i7 $2200 | | |
+---------------+--------------------------+-------------------------+------------------------+ | |
| RAM | 8 GB $100 | 16 GB (OWC) $170 | 16 GB $200 | | |
+---------------+--------------------------+-------------------------+------------------------+ | |
| HD Size/Style | 512 GB SSD $500 | 120 GB SSD (OWC) $140 | 256 GB SSD | | |
| | | 750 GB 7200 RPM $150 | | |
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/ruby | |
# First we save our current branch to a dummy branch | |
# Just in case something goes awry. | |
`git branch -f git-squish-backup` | |
branches = `git branch` | |
curr_branch = /^\*.+/.match(branches)[0] | |
curr_branch.sub!(/^\*./, '') |
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
#include <sys/time.h> | |
#import <Foundation/Foundation.h> | |
int | |
timeval_subtract (result, x, y) | |
struct timeval *result, *x, *y; | |
{ | |
/* Perform the carry for the later subtraction by updating y. */ | |
if (x->tv_usec < y->tv_usec) { | |
int nsec = (y->tv_usec - x->tv_usec) / 1000000 + 1; |
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 | |
WORKSPACE="$(pwd)/XXXXX.xcodeproj/project.xcworkspace" | |
CONFIG="Release" | |
SCHEME="Release" | |
SDK="iphoneos5.0" | |
TARGET="XXXXX" | |
BUILDDIR="$(pwd)/build/Release-iphoneos" | |
APPNAME="XXXXX" | |
DEVELOPER_NAME="iPhone Distribution: XXXXX" |
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
set nocompatible " choose no compatibility with legacy vi | |
syntax enable | |
set encoding=utf-8 | |
set showcmd " display incomplete commands | |
filetype plugin indent on " load file type plugins + indentation | |
set relativenumber " line numbers start from 0 at current line | |
"" Whitespace | |
set nowrap " don't wrap lines | |
set tabstop=2 shiftwidth=2 " a tab is two spaces (or set this to 4) |
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> | |
#define DEBUG | |
//#undef DEBUG | |
//>>>>> snip | |
#ifdef DEBUG | |
static inline NSString * GenerateLorumStringCharCount(NSUInteger count) | |
{ | |
NSString *lorum = @"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. "; |
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
Open "/Users/<UserName>/Library/Application Support/CodeRunner/Languages/5/compile.sh" | |
Change this line: | |
gcc "$1" -o "$compname" -finput-charset=${enc[$2]} -ObjC $3 | |
to | |
clang "$1" -o "$compname" -finput-charset=${enc[$2]} -ObjC $3 |