Skip to content

Instantly share code, notes, and snippets.

View wkiefer's full-sized avatar

Will Kiefer wkiefer

View GitHub Profile
// This is why I love blocks.
// I have an async protocol to add/write a file to disk. Here's the full implementation of one call.
// It's so much easier than managing delegates, threads, callback objects and selectors.
- (void)addStoreItemWithType:(TAStoreItemType)type
identifier:(NSString *)identifier
properties:(NSDictionary *)properties
completionBlock:(void (^)(BOOL success, NSError *error))completionBlock {
dispatch_async(fileio_queue_,
^(void) {
@wkiefer
wkiefer / gist:1145433
Created August 14, 2011 23:08
Recipe

Great Grandma Kiefer's Butter Cookies

  • 1 cup sugar
  • 1 cup butter
  • 1 egg
  • 1 teaspoon vanilla
  • 2 cups cake flour

Cream butter and sugar until creamy. Beat in 1 whole egg and 1 teaspoon of vanilla. Add 2 cups of flour gradually. Drop batter by teaspoon onto greased cookie sheet. Spread with knife dipped in ice water. Bake at 350 degrees until cookies are barely brown around the edges. This will be a very thin cookie.

@wkiefer
wkiefer / Currents_SectionHeader
Created December 10, 2011 18:50
Google Currents: A basic section header template
<style>
.customHeader {
background-color: #f5f5f5;
background-image:url('attachment/CAAqBQgKMIF0MO-foo.png'); /* Use URL from your edition's media library */
background-repeat: no-repeat;
color: #000000;
display: -webkit-box;
font-size: 20px;
height: 60px;
margin-left: 20px;
@wkiefer
wkiefer / GoogleCurrentsSocialHeader
Created December 13, 2011 20:06
Google Currents: Social Header Template
<style type="text/css">
html,body,.tHeader {
margin:0; padding:0; vertical-align:baseline;
border:0; outline:0; font-size:100%;
background-color:transparent; background-repeat:no-repeat;
}
.tHeader {
font-family: 'Currents-Regular-Sans';
overflow: hidden;
@wkiefer
wkiefer / gist:2366514
Created April 12, 2012 11:00
Notes on using NSURLProtocol
// The basics:
// - Write your own NSURLProtocol subclass and register it.
// - Override the 5 required methods
// - Kick off download or cache fetch during |startLoading|
// - Update self.client with progress/completion/failure notifications.
// UIWebView will download requests concurrently via NSURLProtocol.
// If you use the typical NSURLCache hook to download content, you're
// stuck with serial downloads.