Skip to content

Instantly share code, notes, and snippets.

View caoer's full-sized avatar
🎯
Focusing as always

Zitao Xiong caoer

🎯
Focusing as always
View GitHub Profile
@caoer
caoer / NSUserDefault.m
Created October 13, 2012 10:13
Objective-C: Save object to NSUserDefault.m
- (MyCustomObject *)getObject {
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSData *MyCustomObjectEncodedObject = [defaults objectForKey:kMyCustomObjectKEY];
MyCustomObject *MyCustomObject = (MyCustomObject *)[NSKeyedUnarchiver unarchiveObjectWithData: MyCustomObjectEncodedObject];
return MyCustomObject;
}
- (void)setMyCustomObject:(MyCustomObject *)MyCustomObject {
NSData *MyCustomObjectEncodedObject = [NSKeyedArchiver archivedDataWithRootObject:MyCustomObject];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
@caoer
caoer / gist:3214527
Created July 31, 2012 07:33 — forked from jrochkind/gist:2161449
A Capistrano Rails Guide

A Capistrano Rails Guide

by Jonathan Rochkind, http://bibwild.wordpress.com

why cap?

Capistrano automates pushing out a new version of your application to a deployment location.

I've been writing and deploying Rails apps for a while, but I avoided using Capistrano until recently. I've got a pretty simple one-host deployment, and even though everyone said Capistrano was great, every time I tried to get started I just got snowed under not being able to figure out exactly what I wanted to do, and figured I wasn't having that much trouble doing it "manually".

@caoer
caoer / ARCHelper.h
Created July 16, 2012 22:15 — forked from nicklockwood/ARCHelper.h
Objective-C: ARC Helper
//
// ARC Helper
//
// Version 2.1
//
// Created by Nick Lockwood on 05/01/2012.
// Copyright 2012 Charcoal Design
//
// Distributed under the permissive zlib license
// Get the latest version from here: