Skip to content

Instantly share code, notes, and snippets.

View nevyn's full-sized avatar

Nevyn Bengtsson nevyn

View GitHub Profile
@nevyn
nevyn / unity.patch
Created September 27, 2014 15:20
Unity, what the FUCK is wrong with your floating point handling??? How am I supposed to work in teams like this?
diff --git a/Assets/First.unity b/Assets/First.unity
index 3e3a80c..b6bf31e 100644
--- a/Assets/First.unity
+++ b/Assets/First.unity
@@ -125,7 +125,7 @@ Transform:
m_GameObject: {fileID: 365291}
m_LocalRotation: {x: .00736813014, y: .968581915, z: .0814704522, w: -.234856069}
m_LocalPosition: {x: -.0620326661, y: .0539474636, z: -.074327141}
- m_LocalScale: {x: .441447079, y: .441447079, z: .441447109}
+ m_LocalScale: {x: .441447079, y: .441447109, z: .441447109}
@nevyn
nevyn / LookbackPrivateAPIOverrides.m
Last active August 29, 2015 14:06
LookbackPrivateAPIOverrides.m
#import <AVFoundation/AVFoundation.h>
@interface GFCameraRecorder : NSObject
@end
@interface GFCameraRecorder (PrivateAPIOverride)
+ (AVCaptureDevicePosition)captureDevicePosition;
@end
@implementation GFCameraRecorder (PrivateAPIOverride)
+ (AVCaptureDevicePosition)captureDevicePosition
{
- (BOOL)canBecomeFirstResponder
{
return NO;
}
- (BOOL)becomeFirstResponder
{
return NO;
}
func taskize<P1, P2, R1 : AnyObject> (
asyncFunc: (
p1: P1,
p2: P2,
callback: (
r1: R1,
err: NSError?
) -> Void
) -> Void
) -> (p1: P1, p2: P2) -> SPTask
- (void)_displayPendingReviews
{
[[[[[NSFileManager defaultManager]
contentsOfDirectoryAtURL:GFSessionGroupsRoot()
includingPropertiesForKeys:nil
options:NSDirectoryEnumerationSkipsHiddenFiles
error:NULL
] gf_map:^id(NSURL *url) {
return [GFSessionGroup loadFromFileAtURL:url];
}] gf_filter:^BOOL(GFSessionGroup *group) {
@nevyn
nevyn / foo.m
Last active August 29, 2015 14:04
#import <Foundation/Foundation.h>
@interface Foo : NSObject
@property id what;
@end
@implementation Foo
- (BOOL)doingItWrong {
return _what;
}
Jul 21 16:08:34 Moir5 YouTube[3104] <Warning>: <Google> ACTConversionIDReporter: already sent successful ping.
Jul 21 16:08:34 Moir5 YouTube[3104] <Warning>: <Google> ACTRemarketingReporterPrivate: sending ping: http://www.googleadservices.com/pagead/conversion/1001680686/?appversion=2.7.1.11281&bundleid=com.google.ios.youtube&data.screen_name=iOS_YT_App_Open_V2300&label=ZV6UCLLByQYQrt7R3QM&lat=0&muid=M5beL002O1vB-IwDsFAOag&osversion=7.1.2&remarketing_only=1&sdkversion=ct-sdk-i-v3.0.1&timestamp=1405951714.215512.
Jul 21 16:08:34 Moir5 YouTube[3104] <Warning>: <Google> ping successful.
@nevyn
nevyn / GFClock.h
Created July 10, 2014 11:33
Don't use [NSDate timeIntervalFromReferenceDate] if you're working with deltas or timing or anything that isn't directly date related. Use absolute, monotonically increasing time instead. Using mach time is easy but slightly inconvenient; here's a very simple NSDate-like class you can use in your code.
#import <Foundation/Foundation.h>
@interface GFClock : NSObject
+ (instancetype)sharedClock;
// since device boot or something. Monotonically increasing, unaffected by date and time settings
- (NSTimeInterval)absoluteTime;
@end
@nevyn
nevyn / parentprocess.m
Created May 29, 2014 17:20
Prints the name of all the parent processes of this process.
#import <Foundation/Foundation.h>
#import <sys/sysctl.h>
#import <sys/proc_info.h>
#import <libproc.h>
// http://www.objectpark.net/en/parentpid.html
pid_t OPParentIDForProcessID(pid_t pid)
{
struct kinfo_proc info;
size_t length = sizeof(struct kinfo_proc);
### Keybase proof
I hereby claim:
* I am nevyn on github.
* I am nevyn (https://keybase.io/nevyn) on keybase.
* I have a public key whose fingerprint is 4746 A6E5 B607 8617 C3FD 7F18 635F 66E7 2215 2A28
To claim this, I am signing this object: