Skip to content

Instantly share code, notes, and snippets.

@evanlong
evanlong / LWViewController.m
Created March 5, 2012 08:55
Some gesture stuff
#import "LWViewController.h"
@interface LWViewController ()
@property (nonatomic, retain) UIView *outerSubview;
@property (nonatomic, retain) UIView *innerSubview;
@end
@implementation LWViewController
@evanlong
evanlong / .gitconfig
Created February 8, 2012 19:43
When you don't want to bisect... you get someone else to do it for you
[alias]
intern-me-coffee = bisect
@evanlong
evanlong / gist:1692489
Created January 28, 2012 03:48
partial class example
// Started here
class Reader : NSObject {}
class PDFReader_Shared : Reader {}
class PDFReader_iPad : PDFReader_Shared {}
class PDFReader_iPhone : PDFReader_Shared {}
class TextReader_Shared : Reader {}
class TextReader_iPad : TextReader_Shared {}
class TextReader_iPhone : TextReader_Shared {}
@evanlong
evanlong / test_linux.c
Created January 25, 2012 06:39
C Program to print current directories filesnames and lengths
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <dirent.h>
int main(int argc, char** argv) {
DIR *d = opendir(".");
struct dirent *entry = NULL;
@evanlong
evanlong / scoperelease.txt
Created January 11, 2012 01:53
Intead of ARC
Instead of ARC:
Add scoperelease in addition to release and autorelease.
Think of it like scoped_ptr in C++ or more generally how deconstructors
get called for stack allocated objects (end of scope).
- (id)someMethod:(NSInteger)n {
MyObject *o = [[[MyObject alloc] init] scoperelease];
@evanlong
evanlong / capture.py
Created January 3, 2012 04:10
dump stack info along with locals
import sys
def foo(n):
a = "Hello"
b = "bob"
c = 1 / n
return a + " " + b
@evanlong
evanlong / prettycolor.m
Created January 1, 2012 12:04
For Leafo
/*
See screenshot: http://cl.ly/1v1H0Q1z0Z3R0z3X1R25
*/
- (void)loadView {
self.view = [[[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
CGFloat width = self.view.frame.size.width;
@evanlong
evanlong / LWHangDetector.h
Last active November 17, 2016 16:06
Simple Hang Detection
/**
Copyright (C) 2011 Evan Long
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
@evanlong
evanlong / BeerLicense.txt
Created December 23, 2011 06:23
An Improved MIT License. More Beer.
Copyright (C) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
@evanlong
evanlong / thecrash.log
Created December 19, 2011 23:56
remote gdb messed up on a device
0 libsystem_kernel.dylib mach_msg_trap (in libsystem_kernel.dylib) + 20
1 libsystem_kernel.dylib mach_msg (in libsystem_kernel.dylib) + 50
2 libxpc.dylib _xpc_connection_check_in (in libxpc.dylib) + 152
3 libxpc.dylib _xpc_connection_init (in libxpc.dylib) + 1032
4 libxpc.dylib _xpc_connection_wakeup2 (in libxpc.dylib) + 774
5 libxpc.dylib _xpc_connection_wakeup (in libxpc.dylib) + 62
6 libxpc.dylib _xpc_connection_send_registration (in libxpc.dylib) + 24
#If you are reading this... reboot your iOS device. Your problems will probably go away.