Search for Firebase

I wanted a simple way to do searches on my firebase content. Nodejs seemed the way to go, as setting up a server is easy and it works great with Firebase too. As a search engine I decided to use lunr.js, it's fast and easy to setup.

Custom Page Control For UIPageViewController

I've found that the delegate methods from UIPageViewController don't give me enough information to create a perfect page indicator control. pageViewController:willTransitionToViewControllers: is too early and pageViewController:didFinishAnimating:previousViewControllers:transitionCompleted: gets called after the animation is finished which is too late to update a page indicator.

WatchKit Double Tap

Sadly there's no double tap gesture in the current WatchKit version. It is possible though to manually detect double taps.
This isn't possible with a button because the system doesn't send all tap events if one is too fast. But with a table we get all the taps unfiltered and can now messure the time between taps and detect double taps.

Just create a table with one row and put whatever you want tappable inside that row.

@implementation InterfaceController {
    NSDate* _lastTouch;

Self Storing Model

I wanted a simple way to persist my model changes without having any boilerplate code in the model classes. With this solution any model object just has to inherit from Model, that's it.

Android Remote Gallery

Simple Activity to display some images from a server. The images are first downloaded and then presented inside a ViewPager. Works for all Android versions.

Android WebView Content

Sometimes you want to look at the html that’s currently beeing shown in a webview. Using a JavascriptInterface this is easy and works on every Android version.

When using API 17+ you’ll need the @JavascriptInterface annotation.

Metadata Recognition with AVFoundation

iOS 6 let’s you detect faces on a AVCapture preview. In iOS 7 barcodes and qr-codes have been added and work in the same way.

Device and Interface Orientation with iOS

First, you have to know the difference between UIDeviceOrientation and UIInterfaceOrientation. The device orientation is the orientation the device is currently at. We can get the device orientation with this call:

[[UIDevice currentDevice] orientation]

Selecting a Random Record with PHP and MySQL

Selecting a random record with MySQL can be achieved with one simple select:

How To Redirect Mobile Users

Providing a mobile friendly version of your website is defently a good idea. I summed up a few code snippets in different languages to help you redirect the visitor to your mobile website.