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
// Inspired by suggestion to use NSScanner: http://stackoverflow.com/questions/1918972/camelcase-to-underscores-and-back-in-objective-c | |
#import "NSString+Inflections.h" | |
@implementation NSString (Inflections) | |
- (NSString *)underscore | |
{ | |
NSScanner *scanner = [NSScanner scannerWithString:self]; | |
scanner.caseSensitive = YES; |
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 "NSString+UUID.h" | |
@implementation NSString (UUID) | |
+ (NSString *)UUIDString | |
{ | |
CFUUIDRef UUID = CFUUIDCreate(NULL); | |
CFStringRef string = CFUUIDCreateString(NULL, UUID); | |
CFRelease(UUID); | |
return (__bridge_transfer NSString *)string; |
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
- (void)doStuff | |
// Do stuff on main thread | |
dispatch_async(self.queue, ^{ | |
// Do stuff on background thread | |
// self.queue is a serial queue stored as a property on this object | |
dispatch_async(dispatch_get_main_queue(), ^{ | |
// Do stuff on main thread | |
}); |
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
{ | |
"binary_file_patterns": | |
[ | |
"*.jpg", | |
"*.jpeg", | |
"*.png", | |
"*.gif", | |
"*.ttf", | |
"*.tga", | |
"*.dds", |
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
body { color: #222; font: normal normal 400 100%/1.5em georgia,serif; margin: 3em auto; padding: 0 3em; max-width: 46em } | |
a:link { color: #3366CC } | |
a:visited { color: #224488 } | |
blockquote,ol,p,ul { display: block; margin: 0 0 1.5em } | |
blockquote { border-left: solid .1em #E4E4E4; color: #919191; padding: 0 1.5em 0 1.4em } | |
code { font: normal normal 87.5%/1.71428571em monospace,sans-serif } | |
img { display: block; margin: 1.5em auto } | |
pre { display: block; font: normal normal 87.5%/1.71428571em monospace,sans-serif; margin: 1.71428571em } | |
h1,h2,h3,h4,h5,h6 { font-weight: 400 } | |
h1 { font-size: 225%; line-height: 1.3334em; margin: 0 0 .1666em } |
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
#!/usr/bin/env sh | |
if git diff-index --quiet HEAD --; then | |
agvtool next-version -all | |
agvtool new-marketing-version "$1" | |
buildnum=`agvtool vers -terse` | |
git add . | |
git commit -m "New build: $1 ($buildnum)" | |
if [ "$2" = "--release" ]; then |
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
require 'open-uri' | |
require 'hpricot' | |
MINUTES_BETWEEN_CHECKS = 15 | |
URLS = ['http://www.amazon.com/Programming-Ruby-1-9-Pragmatic-Programmers/dp/1934356085/', | |
'http://www.amazon.com/Ultimate-Hitchhikers-Guide-Galaxy/dp/0345453743/'] | |
HISTORY_COUNT = 50 | |
CURRENT_PRICE_ELEMENT = '.priceLarge' | |
prices = {} |
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
from django.db import models | |
from imagekit.models import ImageModel | |
class Photo(ImageModel): | |
name = models.CharField(max_length=100) | |
original_image = models.ImageField(upload_to='photos') | |
num_views = models.PositiveIntegerField(editable=False, default=0) | |
class IKOptions: | |
# This inner class is where we define the ImageKit options for the model |
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
*.pbxproj -crlf -diff -merge |
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 sys | |
import time | |
import urllib | |
import urllib2 | |
from django.core.management import setup_environ | |
# Make we're actually importing and activating the correct settings file here | |
import settings | |
setup_environ(settings) |