Skip to content

Instantly share code, notes, and snippets.

View falkorichter's full-sized avatar
🎯
Focusing

Falko Richter falkorichter

🎯
Focusing
View GitHub Profile
@falkorichter
falkorichter / NotificationSetter.h
Created May 3, 2012 16:02
Anonymous Notification sythesization and setter
#define CUSTOM_NSNOTIFICATION_SETTER(setterMethodName,ivarName,_ivarName)\
\
@synthesize ivarName = _ivarName; \
\
- (void)setterMethodName:(id)ivarName{ \
if (_ivarName != ivarName) { \
if (_ivarName != nil) { \
[[NSNotificationCenter defaultCenter] removeObserver:_ivarName]; \
} \
_ivarName = ivarName; \
@falkorichter
falkorichter / androidShortcuts.sh
Created May 4, 2012 08:19
Android Shortcuts
sudo rm /usr/bin/adb
sudo rm /usr/bin/ddms
sudo rm /usr/bin/android
sudo ln -s /Applications/android-sdk-macosx/platform-tools/adb /usr/bin/adb
sudo ln -s /Applications/android-sdk-macosx/tools/ddms /usr/bin/ddms
sudo ln -s /Applications/android-sdk-macosx/tools/android /usr/bin/android
@falkorichter
falkorichter / AsyncTaskExecutionHelper.java
Created May 23, 2012 08:37 — forked from greenrobot/AsyncTaskExecutionHelper.java
Helper bringing back parallel execution for AsyncTask (you are no serial execution and pseudo threading wimp, right?). Uses level 11 APIs when possible.
package de.greenrobot.util;
import java.util.concurrent.Executor;
import android.os.AsyncTask;
import android.os.Build;
/**
* Uses level 11 APIs when possible to use parallel/serial executors and falls back to standard execution if API level
* is below 11.
@falkorichter
falkorichter / lazySynthesize.h
Created June 11, 2012 11:59
lazySynthesize
#define LAZY_SYNTHESIZE(ivarType, ivarName,_ivarName) \
\
@synthesize ivarName = _ivarName; \
\
- (ivarType*)ivarName{ \
if (_ivarName == nil) { \
_ivarName = [[ivarType alloc] init]; \
} \
return _ivarName; \
} \
@falkorichter
falkorichter / adbIterate.py
Created October 2, 2012 10:52
A script that can do installs and deinstalls on all connected Android devices
import os
import sys
argument = sys.argv[1]
install = False
if argument.endswith(".apk"):
install = True
@falkorichter
falkorichter / mvnProfileHockeyAppAndroidUpload
Created April 2, 2013 17:54
upload your apk directly from your pom
<profile>
<id>hockeyAppUpload</id>
<properties>
<project.property.hockey.mode>true</project.property.hockey.mode>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
@falkorichter
falkorichter / mvnProfileHockeyAppAndroidPrune
Last active December 15, 2015 17:09
Prune old builds from your HockeyApp profile
<profile>
<id>hockeyPrune</id>
<properties>
<project.property.hockey.mode>true</project.property.hockey.mode>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
@falkorichter
falkorichter / mvnPomGreenDaoBuildAndGenerate
Created April 2, 2013 18:07
sample pom for a greenDao code generator who compiles the generator and runs it as part of the build process
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>package.package</groupId>
<artifactId>daoGenerator</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>daoGenerator</name>
@falkorichter
falkorichter / gist:6670726
Created September 23, 2013 13:56
python sniplet that changes the working directory to the folder of the script.
#!/usr/bin/python
baseFolder = os.path.join(os.getcwd(),os.path.split(sys.argv[0])[0])
os.chdir(baseFolder)
hcitool -i hci0 cmd 0x08 0x0008 1e 02 01 1a 1a ff 4c 00 02 15 e2 c5 6d b5 df fb 48 d2 b0 60 d0 f5 a7 10 96 e0 00 00 00 00 c5 00 00 00 00 00 00 00 00 00 00 00 00 00