Skip to content

Instantly share code, notes, and snippets.

@acoomans
acoomans / CustomFilePicker.m
Last active October 13, 2015 15:18
Customize FilePicker private Controller by rerouting
#import <objc/message.h>
IMP tableView_cellForRowAtIndexPath = nil;
IMP viewDidAppear = nil;
CGFloat myMethodIMP(id self, SEL _cmd, UITableView *tableView, int section) {
// implementation ....
NSLog(@"%@", tableView);
NSLog(@"%d", section);
@acoomans
acoomans / twitter_oauth_token.py
Created February 24, 2013 02:52
Quickstart for authenticating and sending a message using python _twitter_oauth_.
# http://pypi.python.org/pypi/twitter_oauth/0.2.0
# pip install twitter_oauth
import twitter_oauth
print "remember to leave callback blank in twitter settings!!"
consumer_key = 'CONSUMER_KEY'
consumer_secret = 'CONSUMER_SECRET'
get_oauth_obj = twitter_oauth.GetOauth(consumer_key, consumer_secret)
@acoomans
acoomans / CPModelTestCase.h
Created February 24, 2013 02:54
Test case class for core data
//
// CPModelTestCase.h
// CoursePad
//
// Created by Arnaud Coomans on 16/01/13.
// Copyright (c) 2013 Archer. All rights reserved.
//
#import <SenTestingKit/SenTestingKit.h>
@acoomans
acoomans / UIViewController+KeyboardNotifications.h
Created March 7, 2013 01:06
Register UIViewController to listen to keyboard notifications
//
// UIViewController+KeyboardNotifications.h
//
//
// Created by Arnaud Coomans on 15/02/13.
// Copyright (c) 2013 Arnaud Coomans. All rights reserved.
//
#import <UIKit/UIKit.h>
@acoomans
acoomans / ViewControllerContainer.m
Last active December 14, 2015 15:08
Container view controller
#pragma mark - container view controller
- (CGRect)frameForContentViewController:(UIViewController*)contentViewController {
return self.view.bounds;
}
- (void)addContentViewController: (UIViewController*)contentViewController; {
[self addChildViewController:contentViewController];
contentViewController.view.frame = [self frameForContentViewController:contentViewController];
[self.view addSubview:contentViewController.view];
@acoomans
acoomans / sim-device.sh
Created March 12, 2013 23:53
Simulator version and device change scripts
#!/bin/sh
exec <"$0" || exit; read v; read v; exec /usr/bin/osascript - "$@"; exit
-- Your AppleScript here
on run argv
if (count argv) is 0 then
set DeviceName to "iPad"
else
set DeviceName to item 1 of argv
@acoomans
acoomans / vlcrecord.sh
Last active February 13, 2021 13:56
Record screen with VLC from command line (needs VLC nightly build)
/Applications/VLC-unstable.app/Contents/MacOS/VLC -I rc screen:// --noaudio --sout "#transcode{vcodec=h264,venc=x264, vb=800,acodec=none,scale=1.0}:std{access=file,mux=mp4,dst=my_first_transcoded_movie.mp4}"
@acoomans
acoomans / proxy.m
Last active December 20, 2015 11:39
delegate proxying
#pragma mark - delegate proxying
- (BOOL)respondsToSelector:(SEL)selector {
return (
[super respondsToSelector:selector] ||
[self.delegate respondsToSelector:selector]
);
}
- (id)forwardingTargetForSelector:(SEL)selector {
@acoomans
acoomans / info.js
Last active December 26, 2015 09:19
UIAutomation target information
var target = UIATarget.localTarget();
// Bundle ID, ie "com.domain.myapp"
UIALogger.logDebug("bundleID: " + target.frontMostApp().bundleID());
// Name, ie "iPhone Simulator"
UIALogger.logDebug("name : " + target.name());
// Model, ie "iPhone Simulator"
UIALogger.logDebug("model: " + target.model());
@acoomans
acoomans / sub_1b1638.c
Created November 10, 2013 07:54
In-memory Instagram 4 key
//__attribute__((noinline))
void sub_1b1638_i(char *v) {
int r11 = 0x37;
int r6 = 0x65;
int r3 = 0x35;
int r2 = 0x38;
int r4 = 0x31;
int r9 = 0x34;
int r12 = 0x61;
int lr = 0x39;