Skip to content

Instantly share code, notes, and snippets.

View pj4533's full-sized avatar

PJ Gray pj4533

View GitHub Profile
@pyrtsa
pyrtsa / Managing-optionals-in-Swift.swift
Last active March 7, 2017 18:39
Managing optionals in Swift
// Hello, fellow Swift programmer!
//
// Here's a demonstration of a few ways of cleaning up the unwrapping of
// optionals in Swift.
//
// Swift is known to have both OO and functional background. Thus, there is
// probably some middle ground programming style that is *more* functional than
// Objective-C, and probably less so than Haskell. This playground tries to
// compare their differences in the pretty common scenario of dealing with
// errors or missing input.
@edwardinubuntu
edwardinubuntu / gist:1111753
Created July 28, 2011 15:31
applicationDidBecomeActive
- (void)applicationDidBecomeActive:(UIApplication *)application {
...
// Initial Google analytics
[[GANTrackersharedTracker] startTrackerWithAccountID:
@"UA-xxxxxxxx-y"dispatchPeriod:
kGANDispatchPeriodSecdelegate:self];
...
}
@mdippery
mdippery / FileTailer.m
Created January 12, 2011 23:02
A class that mimics `tail -f`
//
// Created by Michael Dippery on 1/12/2011.
// Copyright 2011 Michael Dippery. All rights reserved.
//
#import "FileTailer.h"
@implementation FileTailer
- (id)initWithPath:(NSString *)path refreshPeriod:(NSTimeInterval)aRefresh