Skip to content

Instantly share code, notes, and snippets.

View jzucker2's full-sized avatar

Jordan Zucker jzucker2

  • PubNub
  • San Francisco
View GitHub Profile
@jzucker2
jzucker2 / .gitconfig
Last active August 29, 2015 14:13
My ps1/git completion
[user]
email = jordan.zucker@gmail.com
name = Jordan Zucker
[alias]
cm = commit -m
swap = checkout -
lc = log ORIG_HEAD.. --stat --no-merges
mkbr = checkout -b
sm = submodule update --init --recursive
llog = log --date=local
@jzucker2
jzucker2 / .gitignore
Last active August 29, 2015 14:14
My Obj-C gitignore
# Mac
.DS_Store
# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
@jzucker2
jzucker2 / git-completion.bash
Last active June 24, 2016 21:00
My Shell Setup
# bash/zsh completion support for core Git.
#
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/).
# Distributed under the GNU General Public License, version 2.0.
#
# The contained completion routines provide support for completing:
#
# *) local and remote branch names
# *) local and remote tag names
@jzucker2
jzucker2 / Podfile
Created March 31, 2015 05:49
Podfile
source 'https://github.com/CocoaPods/Specs.git'
xcodeproj '<XcodeProject>/<XcodeProject>.xcodeproj'
platform :ios, '8.0'
#pod 'AFNetworking', '~>2.5.2'
pod 'BlocksKit', '~>2.2.5'
pod 'CocoaLumberjack', '~> 2.0'
@jzucker2
jzucker2 / Singleton.m
Last active March 8, 2016 17:44
Singleton
#import <Foundation/Foundation.h>
@interface Singleton : NSObject
+ (instancetype)sharedManager;
@end
@implementation Singleton
+ (instancetype)sharedInstance {
static Singleton *sharedInstance = nil;
static dispatch_once_t onceToken;
@jzucker2
jzucker2 / gist:bc2f5ad5b56045317c50
Created June 4, 2015 06:56
Sample multi response layout
@interface PNHistoryResult : PNResult
@property (nonatomic) NSDate *start;
@property (nonatomic) NSDate *end;
@end
// no methods on any of these subclasses
@interface PNHereNowResult : PNResult
@property (nonatomic) NSInteger occupancy;
@end
@jzucker2
jzucker2 / FinderCommands
Last active August 29, 2015 14:22
Finder commands
# set up destination for screenshots
mkdir ~/Screenshots; defaults write com.apple.screencapture location ~/Screenshots; killall SystemUIServer; echo "Desktop clutter begone"
# this adds a recently used applications stack to the dock
defaults write com.apple.dock persistent-others -array-add '{ "tile-data" = { "list-type" = 1; }; "tile-type" = "recents-tile"; }'; killall Dock
@jzucker2
jzucker2 / BatchedSubscribe
Created June 22, 2015 22:19
Example of batched subscribe issue
self.subscribeExpectation = [self expectationWithDescription:@"network"];
[self.client subscribeToChannels:@[@"a", @"b"] withPresence:YES];
[self.client subscribeToChannels:@[@"c"] withPresence:NO];
[self waitForExpectationsWithTimeout:10 handler:^(NSError *error) {
if (error) {
NSLog(@"error: %@", error);
XCTFail(@"what went wrong?");
}
}];
@jzucker2
jzucker2 / ExhaustiveTests
Created June 29, 2015 18:22
Example proper test
- (void)weak_testHereNow {
self.testExpectation = [self expectationWithDescription:@"network"];
[self.client hereNowWithCompletion:^(PNPresenceGlobalHereNowResult *result, PNErrorStatus *status) {
XCTAssertNil(status);
XCTAssertEqual([result operation], PNHereNowGlobalOperation, @"Wrong operation");
XCTAssertNotNil([result data]);
XCTAssertEqual([result statusCode], 200);
[self.testExpectation fulfill];
}];
@jzucker2
jzucker2 / Podfile
Last active December 15, 2023 20:52
Sample Podfile
# It's good practice to include the Pod source in your Podfile
source 'https://github.com/CocoaPods/Specs.git'
# specify platform and target OS version
platform :ios, '7.0'
# this would be the relative path of your app, whatever that may be
xcodeproj 'SimplePubSub/SimplePubSub.xcodeproj'
# this is the relative location of your workspace, I prefer to explicity