Skip to content

Instantly share code, notes, and snippets.

View paulyoung's full-sized avatar
💭
Type check and prove things

Paul Young paulyoung

💭
Type check and prove things
View GitHub Profile
@aufflick
aufflick / .lldbinit
Created February 12, 2014 00:03
my Reveal lldb setup, based on @orj and @chrismiles efforts
command script import /opt/lldb-scripts/reveal.py
command alias interface_inspector p (BOOL)[[NSBundle bundleWithPath:@"/Applications/Interface Inspector.app/Contents/Resources/InterfaceInspectorRemote.framework"] load]
command alias reveal_load_sim expr (void*)dlopen("/Applications/Reveal.app/Contents/SharedSupport/iOS-Libraries/libReveal.dylib", 0x2);
command alias reveal_load_dev expr (void*)dlopen([(NSString*)[(NSBundle*)[NSBundle mainBundle] pathForResource:@"libReveal" ofType:@"dylib"] cStringUsingEncoding:0x4], 0x2);
command alias reveal_start expr (void)[(NSNotificationCenter*)[NSNotificationCenter defaultCenter] postNotificationName:@"IBARevealRequestStart" object:nil];
command alias reveal_stop expr (void)[(NSNotificationCenter*)[NSNotificationCenter defaultCenter] postNotificationName:@"IBARevealRequestStop" object:nil];
@orta
orta / network-models.md
Last active August 29, 2015 13:56
Network models

Using a real artsy example from today.

Creating a follow button on a view controller for different types of objects Artist, Profile, Gene

Needs: networking Needs: layout Needs: interface changes based on networking

Networking

@matthiasplappert
matthiasplappert / gist:9493050
Last active August 29, 2015 13:57
QuickLook Debugging for `UIView`
@interface UIView (MPAdditions)
@end
@implementation UIView (MPAdditions)
- (id)debugQuickLookObject {
if (self.bounds.size.width < 0.0f || self.bounds.size.height < 0.0f) {
return nil;
}
@orta
orta / .travis.yml
Created April 14, 2014 21:15
Artsy Travis File
language: objective-c
before_install: gem install xcpretty -N
script:
- set -o pipefail
- make ci
@robrix
robrix / sliding-goes-to.c
Last active August 29, 2015 14:00
The sliding goes-to operator in C
#include <stdio.h>
int main(int argc, char *argv[]) {
int i = 10;
while (i \
\
\
\
--> 0) { printf("%i\n", i); }
return EXIT_SUCCESS;
@CodaFi
CodaFi / LOLJava.md
Last active August 29, 2015 14:00
PublicStaticAbstractClassFactoryComplaintSingletonElvisSwingFrameInnerFrameFrameBufferObjectFactoryClassFactoryDelegate

Quick note: All that applies here is for the latest Java 7.x, which everybody is using anyways because rule number one among computer users nowadays is DONT INSTALL JAVA WHEN YOUR BROWSER ASKS YOU TO.

##Class Design

Lack of interfaces means reading the comments-strewn source for a class is tedious. JavaDoc tries its best.

Arrays of any kind declared public static final are always mutable unless they are of length zero (at which point, you should be fired for declaring such an array).

Projects are rife with degenerate classes of the sort

@steipete
steipete / AppDelegate.m
Last active August 29, 2015 14:01
I'm using Aspects to hook into Xcode's test system to update the UI as the tests are running - this provides a nice feedback what's currently going on. https://github.com/steipete/Aspects
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
self.window = [[UIWindow alloc] initWithFrame:UIScreen.mainScreen.bounds];
self.window.backgroundColor = [UIColor whiteColor];
UIViewController *controller = [UIViewController new];
controller.title = @"Testing...";
self.rootViewController = [[UINavigationController alloc] initWithRootViewController:controller];
self.window.rootViewController = self.rootViewController;
[self.window makeKeyAndVisible];
// Use Aspects to hook into XCTestCase to get better feedback than just the log.
@tonyarnold
tonyarnold / clang-format
Last active August 29, 2015 14:01
My current ~/.clang-format
BasedOnStyle: Chromium
AlignTrailingComments: true
BreakBeforeBraces: Allman
ColumnLimit: 0
IndentWidth: 4
KeepEmptyLinesAtTheStartOfBlocks: false
ObjCSpaceAfterProperty: true
ObjCSpaceBeforeProtocolList: true
PointerBindsToType: false
SpacesBeforeTrailingComments: 1
@wessmith
wessmith / pod-install-post-checkout.sh
Last active August 29, 2015 14:01
pod install post-checkout script
#!/bin/bash
PREVIOUS_HEAD=$1
NEW_HEAD=$2
BRANCH_SWITCH=$3
if [[ $BRANCH_SWITCH == "1" && $PREVIOUS_HEAD != $NEW_HEAD ]]; then
# Kill the simulator.
SIM=`pgrep 'iPhone Simulator'`
@landonf
landonf / 1-XSmallTest-Usage.m
Last active August 29, 2015 14:02
A much nicer single-header XCTest-compatible testing DSL, all in a single header.
#import "XSmallTests.h"
xsm_given("an integer value") {
int v;
xsm_when("the value is 42") {
v = 42;
xsm_then("the value is the answer to the life, the universe, and everything") {
XCTAssertEqual(42, v);
}