Skip to content

Instantly share code, notes, and snippets.

View robpearson's full-sized avatar

Rob Pearson robpearson

View GitHub Profile
@robpearson
robpearson / MPXLocationService.m
Last active August 29, 2015 13:59
User Location Signal
// Location Service
- (RACSignal *)locationSignal {
// NOTE: Location service is a singleton thus no strongify/weakify
// TODO: Review previous service code to add checks on last object to ensure that it's up-to-date and of the correct accuracy.
// TODO: Review how to restart the timer. I'm currently using take: 1 so it's not needed immediately.
RACSignal *locationSignal = [[RACSignal
@robpearson
robpearson / ReactiveIntervalPoller.m
Created April 16, 2014 21:47
ReactiveCocoa interval (polling) signal
@weakify(self);
RACSignal *timerSignal = [RACSignal
interval:10 onScheduler:[RACScheduler mainThreadScheduler]];
self.somethingSignal = [timerSignal
map:^id(id value) {
@strongify(self);
return self.something;
// One Off
RACSignal *currentUserLocationSignalX = [self.locationService.locationSignal take:1];
// Refresh User Location on a interval timer
RACSignal *currentUserLocationIntervalSignal = [[[RACSignal
interval:60
onScheduler:RACScheduler.scheduler]
map:^id(id value) {
strongify(self);
return [self.locationService.locationSignal take:1];
@robpearson
robpearson / spike.m
Last active August 29, 2015 14:07
Animation Delay Signal
RACSignal *isWorkingSignal = [[RACObserve(object, isWorking)
map:^id(NSNumber *isWorking) {
if (YES == [isWorking boolValue]) {
NSTimeInterval delayInterval = 2; // seconds
return [[RACSignal return:isWorking] delay:delayInterval];
} else {
return [RACSignal return:isWorking];
}
}] switchToLatest];
@robpearson
robpearson / MPXLocationService.h
Created January 10, 2015 11:26
Reactive Location Service
//
// Created by Rob Pearson on 28/08/13.
// Copyright (c) 2013 Maple Pixel Pty. Ltd. All rights reserved.
//
// To change the template use AppCode | Preferences | File Templates.
//
#import <Foundation/Foundation.h>
#import <CoreLocation/CoreLocation.h>
@robpearson
robpearson / MPXTransitDashboardViewModel.m
Created February 17, 2015 00:37
Everyday Transit Hourly Interval Signal with an initial value.
#import "DateTools.h"
#import "RACEXTScope.h"
#import "ReactiveCocoa.h"
@interface MPXTransitDashboardViewModel ()
/// ...
@end
@robpearson
robpearson / keybaseio.md
Created April 14, 2016 23:29
keybase.io

Keybase proof

I hereby claim:

  • I am robpearson on github.
  • I am robpearson (https://keybase.io/robpearson) on keybase.
  • I have a public key whose fingerprint is 98DB 6E9E 1504 3DB1 5337 7900 4E53 4510 2A46 C11C

To claim this, I am signing this object:

@robpearson
robpearson / AppleDongleLife.md
Last active August 3, 2017 06:54
Apple MacBook Pro Dongle Recommendations

First, I wouldn't buy any official Apple adapters/dongles. They're very expensive and the reviews for a lot of them are terrible. One guy at Octopus bought Apple's USB-C Digital AV Multiport Adapter and it was dead on arrival. Apple replaced it happily but it's compatibility isn't supposed to be great.

Single hub or dock

@robpearson
robpearson / NewMacSetup.md
Created August 2, 2017 23:36
New Mac Setup

New Mac Setup notes

Also see Casey Liss' new mac setup notes.

  • Setup as a new Mac. Provided Apple ID details etc.
  • Turned FileVault on as a part of the install process. Required for work as well.
  • Configure Sys Prefs
    • General - Dark Menu Bar and Dock
    • Touchpad - Set scroll direction to normal (not natural)
  • Desktop - Set background to Black Price 015.jpg
@robpearson
robpearson / randomquotes-build.ps1
Created March 13, 2019 04:10
Random Quotes AppVeyor build script
# Publish the application to a folder
dotnet publish C:\Projects\RandomQuotes\RandomQuotes.sln --output published-app --configuration Release
# Package the folder into a ZIP
octo pack --id RandomQuotes --version $env:APPVEYOR_BUILD_VERSION --basePath C:\projects\RandomQuotes\RandomQuotes\published-app
# Push Build Artifact AppVeyor Deployment with Octopus
appveyor PushArtifact C:\projects\randomquotes\RandomQuotes.$env:APPVEYOR_BUILD_VERSION.nupkg -Type OctopusPackage