Skip to content

Instantly share code, notes, and snippets.

@ignasi
ignasi / db_getter.sh
Created January 30, 2014 11:43
Get database from an Android app (Android 4.3+)
#!/bin/bash
# Android 4.3+ changes app's internal directory permissions and you can not just pull your
# databases to your computer, so I did this as a workaround to extract my databases.
# I only use it for debug, use it under your responsability.
package=$1
db_name=$2
path="/data/data/$package/"
@alvesjtiago
alvesjtiago / NSInvocation+SimpleCreation.h
Created December 25, 2013 12:54
Create invocations the simple way. Extracted from ITActionManager.
//
// NSInvocation+SimpleCreation.h
// MAPI
//
// Created by Tiago Alves on 08/12/13.
// Copyright (c) 2013 Iterar. All rights reserved.
//
#import <Foundation/Foundation.h>
@ondev
ondev / gist:6714742
Created September 26, 2013 14:08
iOS Common Macro
//
// CommonMacro.h
//
//
// Created by Haven on 26/9/13.
// Copyright (c) 2013 LF. All rights reserved.
//
#import <CoreTelephony/CTTelephonyNetworkInfo.h>
#import <CoreTelephony/CTCarrier.h>
@bclymer
bclymer / ThreadManager.java
Last active May 25, 2019 13:16
A class to help you do thread-y things in Java.
package com.example.threadmanagertests;
import java.lang.Thread.UncaughtExceptionHandler;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
@aegzorz
aegzorz / NSObject+LogDealloc.h
Last active October 16, 2021 13:08
Category on NSObject that logs deallocs, useful when tracking down memory leaks
#import <Foundation/Foundation.h>
@interface NSObject (LogDealloc)
- (void)logOnDealloc;
@end
@aegzorz
aegzorz / UIView+Recursion.h
Created July 11, 2013 10:40
Recursively find a subview.
#import <UIKit/UIKit.h>
@interface UIView (Recursion)
/**
Return YES from the block to recurse into the subview.
Set stop to YES to return the subview.
*/
- (UIView*)findViewRecursively:(BOOL(^)(UIView* subview, BOOL* stop))recurse;
@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/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
#
@tonyarnold
tonyarnold / gist:2010649
Created March 10, 2012 07:22
Exhaustively check if an Objective-C object is "empty"
static inline BOOL CBIsEmpty(id obj) {
return obj == nil
|| (NSNull *)obj == [NSNull null]
|| ([obj respondsToSelector:@selector(length)] && [obj length] == 0)
|| ([obj respondsToSelector:@selector(count)] && [obj count] == 0);
}