Skip to content

Instantly share code, notes, and snippets.

View ashfurrow's full-sized avatar

Ash Furrow ashfurrow

View GitHub Profile
@tapi
tapi / NSObject+SMDictionaryMapper.h
Created April 25, 2012 11:37
Dictionary <--> Object Mapper for Objective-C
//
// NSObject+SMDictionaryMapping.h
// SoundTrack
//
// Created by Paddy O'Brien on 12-04-24.
// Copyright (c) 2012 Paddy O'Brien. All rights reserved.
//
#import <Foundation/Foundation.h>
@tapi
tapi / .gitignore
Last active December 15, 2015 20:49 — forked from adamgit/.gitignore
Adds the AppCode .idea folder
#########################
# .gitignore file for Xcode4 / OS X Source projects
#
# Version 2.0
# For latest version, see: http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects
#
# 2013 updates:
# - fixed the broken "save personal Schemes"
#
# NB: if you are storing "built" products, this WILL NOT WORK,
@chriseidhof
chriseidhof / gist:5687433
Created May 31, 2013 19:36
A method that you can use in your test cases so you'll have a managed object context around.
- (NSManagedObjectContext*)managedObjectContextForTesting {
NSURL *modelURL = [[NSBundle mainBundle] URLForResource:@"YourModelName" withExtension:@"momd"];
NSManagedObjectModel* model = [[NSManagedObjectModel alloc] initWithContentsOfURL:modelURL];
NSPersistentStoreCoordinator* coordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:model];
[coordinator addPersistentStoreWithType:NSInMemoryStoreType configuration:nil URL:nil options:nil error:NULL];
NSManagedObjectContext* managedObjectContext= [[NSManagedObjectContext alloc] init];
managedObjectContext.persistentStoreCoordinator = coordinator;
return managedObjectContext;
}
@jspahrsummers
jspahrsummers / gist:7000136
Last active December 25, 2015 15:39
Various use cases that need to be considered for ReactiveCocoa 3.0, along with their current RAC 2.x or Rx solutions

Use cases

  1. Turning an eager, pure computation into a lazy one: RACSequence, RACSignal
  2. Side-effecting work that is safe to perform multiple times: RACSignal, RACCommand
  3. Side-effecting work that is safe to perform multiple times serially, but not concurrently: RACCommand, RefCount()
    • RACScheduler would seem to apply here, but execution could become interleaved and thus not serial
  4. Side-effecting work that should only be performed once, then memoized: RACMulticastConnection with a RACReplaySubject, RACSequence
  5. Enabling/disabling a UI based on whether work can be performed: RACCommand, RACReplaySubject
    • Replaying is a Good Idea™ because this information may arrive before the UI is ready for it
  6. Updating a UI with information about work in progress: RACCommand, RACSubject
//
// NSObject+TypeValidation.h
//
// Created by Jerry Jones on 5/15/12.
// Copyright (c) 2012 Spaceman Labs, LLC. All rights reserved.
//
#import <Foundation/Foundation.h>
BOOL CFTypeIsNull(id object);
@nicklockwood
nicklockwood / gist:8537947
Last active January 3, 2016 23:49
The Perfect Language

It's Impossible

I have reluctantly come to accept that it is impossible to create a "perfect" programming language. Every language is domain-specific in some sense, and many of the criteria that make a language good for one purpose are fundamentally in opposition to qualities that are good for another.

A classic example would be "scripting" languages versus "embedded" languages.

Good qualities in a scripting language are:

  • Dynamic typing (no need to specify types, or cast between them)
@abevoelker
abevoelker / policy.json
Created March 31, 2014 01:20
S3 bucket policy to whitelist access to CloudFlare (IPv6 addresses don't seem to be supported in bucket policies)
{
"Id": "Policy1234",
"Statement": [
{
"Sid": "Stmt1234",
"Action": [
"s3:GetObject"
],
"Effect": "Allow",
"Resource": "arn:aws:s3:::foo/*",
@jspahrsummers
jspahrsummers / gist:7080228
Last active May 2, 2019 11:56
Advantages and disadvantages to RACCommand under MVVM

MVVM example

For a command that initiates a network request when:

  • The network connection is up (precondition)
  • The network request is not already in progress (enforced serialization)

The lifecycle proceeds as follows:

  1. The view model exposes the command and describes its behavior
@landonf
landonf / xcode-gripes.md
Last active August 21, 2020 09:06
Every time I hit something that annoys me in Xcode, I add the feature/UX improvement/change I'd like to the list.

Xcode Wish List:

Legacy Support

  • Additional optional downloads:
    • Older SDKs, eg, for building ancient projects.
    • Older compilers (for same).
  • Either ship gcc/llvm-gcc or don't. Don't ship clang and call it 'gcc', that just breaks anyone who actually needs GCC and finds your not-gcc in the PATH.

UX

Project/File Navigation

First grep the heroku logs for the message that will state that the debugger service has started:

$ heroku logs -t --app=[APP_ID] | grep 'Debugger listening on'

Then in another shell enable the debugger service of the Node process by connecting through SSH and sending the process SIGUSR1:

$ heroku ps:exec --app=[APP_ID]