Skip to content

Instantly share code, notes, and snippets.

View tonyarnold's full-sized avatar

Tony Arnold tonyarnold

View GitHub Profile
// Refresh user details on initial creation of client
[[fetchedClient fetchCurrentUser] subscribeNext:^(ANKUser *user) {
@strongify(self);
// Do something with context such as save here…
} error:^(NSError *error) {
NSLogError(error);
}];
@tonyarnold
tonyarnold / atom
Created March 12, 2014 23:53
GitHub's Atom expects to be in `/Applications` — I prefer to keep it in `~/Applications` with other non-AppStore apps. Unfortunately, this means that the command line `atom` command won't work out of the box. Update your copy of `/usr/local/bin/atom` to the following to have it work as expected no matter where it's installed on your Mac!
#!/bin/sh
ATOM_PATH=${ATOM_PATH-$(mdfind "kind:app Atom")}
ATOM_BINARY=$ATOM_PATH/Contents/MacOS/Atom
if [ ! -d $ATOM_PATH ]; then sleep 5; fi # Wait for Atom to reappear, Sparkle may be replacing it.
if [ ! -d $ATOM_PATH ]; then
echo "Atom application not found at '$ATOM_PATH'" >&2
exit 1
fi
//
// Created by Tony Arnold on 22/03/2014.
// Copyright (c) 2014 The CocoaBots. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface NSArray (CocoaBotsAdditions)
- (NSSet *)tcb_objectsPassingTest:(BOOL (^)(id obj, BOOL *stop))predicate;
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -seed -r
@tonyarnold
tonyarnold / Gemfile
Created March 26, 2014 11:29
Gemfile that installs jekyll project dependencies and uses a patched version of gsl for Mac OS X Mavericks
source 'https://rubygems.org'
gem 'jekyll'
gem 'sass'
gem 'kramdown'
gem 'rouge'
gem 'rake'
gem 'narray', :git => "https://github.com/tonyarnold/narray"
gem 'gsl', :git => "https://github.com/tonyarnold/rb-gsl"
Pod::Spec.new do |s|
s.name = "ReactiveCocoa"
s.version = "2.3"
s.summary = "A framework for composing and transforming streams of values."
s.homepage = "https://github.com/blog/1107-reactivecocoa-is-now-open-source"
s.author = { "Josh Abernathy" => "josh@github.com" }
s.source = { :git => "https://github.com/ReactiveCocoa/ReactiveCocoa.git", :tag => "v#{s.version}" }
s.license = 'MIT'
s.description = "ReactiveCocoa (RAC) is an Objective-C framework for Functional Reactive Programming. It provides APIs for composing and transforming streams of values."
// NSManagedObjectContext+DebugSwizzling.h
#import <CoreData/CoreData.h>
#if DEBUG
/**
* Toggles debugging of Core Data managed object contexts.
*
* When enabled, will fire NSLogs in the following cases:
Pod::Spec.new do |s|
s.name = 'INAppStoreWindow'
s.version = '1.4dev'
s.summary = 'Mac App Store style NSWindow subclass.'
s.homepage = 'https://github.com/indragiek/INAppStoreWindow'
s.author = { 'Indragie Karunaratne' => 'i@indragie.com' }
s.source = { :git => 'https://github.com/indragiek/INAppStoreWindow.git', :branch => 'master' } #:tag => "v#{s.version}" }
s.platform = :osx
s.requires_arc = true
s.license = { :type => 'BSD', :text => 'INAppStoreWindow is licensed under the BSD license.'}
#if DEBUG
/**
Toggles assertion of Core Data managed object contexts. Only available when DEBUG is defined.
When enabled, your application will throw an exception when accessing or modifying entities in a context other than their own.
*/
void TCBToggleAssertingContextQueues();
#endif
//
// Created by Tony Arnold on 4/03/2014.
// Copyright (c) 2014 The CocoaBots. All rights reserved.
//
#import "NSView+TCBAdditions.h"
#import <objc/runtime.h>
@implementation NSView (TCBAdditions)