Skip to content

Instantly share code, notes, and snippets.

@seivan
seivan / assets.rake
Created March 15, 2013 01:39 — forked from sj26/assets.rake
# Stick this in lib/tasks/assets.rake or similar
#
# A bug was introduced in rails in 7f1a666d causing the whole application cache
# to be cleared everytime a precompile is run, but it is not neccesary and just
# slows down precompiling.
#
# Secondary consequences are the clearing of the whole cache, which if using
# the default file cache could cause an application level performance hit.
#
# This is already fixed in sprockets-rails for rails 4, but we patch here for
/*
* BPGeometry.h
*
* Created by Jon Olson on 11/30/09.
* Copyright 2009 Ballistic Pigeon, LLC. All rights reserved.
*
*/
#import <Foundation/Foundation.h>
#define MSDesignatedInitializer(__SEL__) __attribute__((unavailable("Invoke the designated initializer `" # __SEL__ "` instead.")))
// Sample usage:
- (id)initWithObject:(id)object;
- (id)init MSDesignatedInitializer(initWithObject:); // <- This even gets auto-complete.
// Now calling init on this class would throw a warning.
#import <pthread.h>
static void unsafe_signal_handler (int signo) {
/* Try to fetch thread names with the pthread API */
char name[512];
NSLog(@"Trying to use the pthread API from a signal handler. Is a deadlock coming?");
pthread_getname_np(pthread_self(), name, sizeof(name));
// We'll never reach this point. The process will stop here until the OS watchdog
// kills it in 20+ seconds, or the user force quits it. No crash report (or a partial corrupt
//
// UIImage+vImageScaling.h
// UIImage+vImageScaling
//
// Created by Matt Donnelly on 03/07/2013.
// Copyright (c) 2013 Matt Donnelly. All rights reserved.
//
#import <UIKit/UIKit.h>
TLDR
If you want the simplest option just start /** [content] */ slashes in your header files. Do it before the @implementation for class comments and above methods for method documentation.
Doing this is the minimal for support in LLVM and Appledoc, which means you get CocoaDocs & XCode support.
Not TLDR
Good examples:
https://github.com/marcransome/MRBrew/blob/master/MRBrew/MRBrew.h
https://github.com/AFNetworking/AFNetworking/blob/master/AFNetworking/AFHTTPClient.h

Rule 0: Do not make a framework.

Ask yourself if you should be making a framework given that you are not in the business of making frameworks. Believe it or not, most of us have the urge to solve problems completely and in the general case as our first inclination, but getting things done requires not doing so almost all of the time.

Rule 1: Do not have dependencies on other 3rd party frameworks.

Frameworks should be modular and standalone. They should require nothing but the standard system libraries in order to run. If the framework relies on other functionality, it should encompass it entirely. If it cannot, it probably violates Rule 3.

Rule 2: Use a non-viral open-source license like MIT or Apache, NOT GPL.

@seivan
seivan / then.m
Created August 15, 2013 14:59 — forked from tonyarnold/then.m
self.currentlyLoggingIn = NO;
self.didLoginSubject = [RACSubject subject];
self.loginCommand = [RACCommand commandWithCanExecuteSignal:[RACSignal
combineLatest:@[self.usernameTextField.rac_textSignal,
self.passwordTextField.rac_textSignal,
RACObserve(self, currentlyLoggingIn)]
reduce:^(NSString *username, NSString *password, NSNumber *currentlyLoggingIn) {
return @(username.length > 0 && password.length > 0 && NO == currentlyLoggingIn.boolValue );
}]];

(Also posted to hacker news, if you find it useful and thing others would, up vote it there: https://news.ycombinator.com/item?id=7043450)

Hi Jonathan,

My name is XXXX. I currently work at XXXX, but have been building apps on the side for the past few years, and have my first tech & iOS engineering interview in a few weeks. I’ve looked up to you and your work for quite a while, and was wondering if you had any tips or advice.

Pod::Spec.new do |s|
name = "PLCrashReporter"
version = "1.2-rc2"
s.name = name
s.version = version
s.summary = "Reliable, open-source crash reporting for iOS and Mac OS X."
s.description = <<-DESC
Plausible CrashReporter provides an in-process crash reporting