Skip to content

Instantly share code, notes, and snippets.

View drunknbass's full-sized avatar
🏠
Working from home

Aaron Alexander drunknbass

🏠
Working from home
View GitHub Profile
- (UIImage*)getImageFromWindow:(UIWindow*)aWindow {
UIGraphicsBeginImageContext(aWindow.bounds.size);
[aWindow.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return image;
}
@drunknbass
drunknbass / gist:986295
Created May 23, 2011 05:59
Fix for discarded touch events on iOS
while( CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.01f, FALSE) ==
     kCFRunLoopRunHandledSource);
@drunknbass
drunknbass / hack.sh
Created April 1, 2012 00:23 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@drunknbass
drunknbass / gist:2872648
Created June 5, 2012 04:31
iCloud cheat sheet
via http://infinite-labs.net/bp/#icloud
dancing the sweet sync tango
Mon 4th
iCloud file sync is in my opinion not adopted enough. It may be that the docs are long. Here is iCloud in a couple of useful nuggets:
Turn on iCloud in your entitlements. In Xcode, you can find 'em in your target, under the Summary tab, at the bottom. Turn on 'Enable Entitlements' and press + on the iCloud Containers list.
You get a folder. Stuff in it gets synchronized around. This is the easy part. You can use the -[NSFileManager URLForUbiquityContainerIdentifier:] call to find out where the container is.
@drunknbass
drunknbass / SpringBoardServices_DUMP_6.0
Created June 15, 2012 05:13
SpringBoard Services 6.0 dump
/SpringBoardServices:
(__TEXT,__text) section
_SBAppWillOrderInContext:
30bf0428 b590 push {r4, r7, lr}
30bf042a af01 add r7, sp, #4
30bf042c b08e sub sp, #56
30bf042e f64134ca movw r4, 0x1bca
30bf0432 f10d0c2c add.w ip, sp, #44 @ 0x2c
30bf0436 f6c0044f movt r4, 0x84f
30bf043a 447c add r4, pc
@drunknbass
drunknbass / gist:3016703
Created June 29, 2012 08:42
Springboard stuff
// Taken from http://www.opensource.apple.com/source/lldb/lldb-69/tools/debugserver/source/RNBServices.cpp
RNBServices.cpp [plain text]
//===-- RNBServices.cpp -----------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
- (NSArray *) runningProcesses {
//CTL_KERN,KERN_PROC,KERN_PROC_ALL
int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_ALL ,0};
size_t miblen = 4;
size_t size;
int st = sysctl(mib, miblen, NULL, &size, NULL, 0);
struct kinfo_proc * process = NULL;
struct kinfo_proc * newprocess = NULL;
@drunknbass
drunknbass / gist:3074015
Created July 9, 2012 03:08
Swizzletastic
#include <objc/runtime.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "SwizzleMyNizzleProtocol.h"
void SwizzleMethod(Class _class, SEL sel, IMP imp, const char *prefix) {
if (_class == nil)
/System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage
extern uint32_t dyld_get_program_sdk_version() WEAK_IMPORT_ATTRIBUTE;
extern BOOL DZApplicationUsesLegacyUI(void)
{
static dispatch_once_t onceToken;
static BOOL legacyUI = NO;
dispatch_once(&onceToken, ^{
uint32_t sdk = __IPHONE_OS_VERSION_MIN_REQUIRED;
if (dyld_get_program_sdk_version != NULL) {
sdk = dyld_get_program_sdk_version();