Skip to content

Instantly share code, notes, and snippets.

View onigunn's full-sized avatar

Onur Güngören onigunn

View GitHub Profile
@onigunn
onigunn / Java: CursorFragmentPagerAdapter.java
Last active October 13, 2015 02:57 — forked from peterkuterna/CursorFragmentPagerAdapter.java
A FragmentPagerAdapter that exposes data from a Cursor
package com.example;
import android.content.Context;
import android.database.Cursor;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.util.SparseIntArray;
import android.view.ViewGroup;
// needed imports
#import <objc/runtime.h>
#import <objc/message.h>
// init swizzling
- (void)navigationControllerSwizzling
{
Method orgPushViewControllerMethod = class_getInstanceMethod([UINavigationController class], @selector(pushViewController:animated:));
Method newPushViewControllerMethod = class_getInstanceMethod([UINavigationController class], @selector(GG_pushViewController:animated:));
import java.io.File;
import java.io.IOException;
import android.annotation.SuppressLint;
import android.content.Context;
import android.os.Build;
import android.os.Environment;
import android.util.Log;
/**
@onigunn
onigunn / gist:6447047
Created September 5, 2013 07:29
Change JAVA_HOME in Mac OS X
export JAVA_HOME=`/usr/libexec/java_home -v 1.6`
or
export JAVA_HOME=`/usr/libexec/java_home -v 1.7`
@onigunn
onigunn / ModelController.php
Created January 21, 2016 10:23 — forked from oliverthiele/ModelController.php
Debugging errors like "An error occurred while trying to call Vendor\ExtKey\Controller\ModelController->showAction() " in extbase extensions
/**
* A special action which is called if the originally intended action could
* not be called, for example if the arguments were not valid.
*
* The default implementation sets a flash message, request errors and forwards back
* to the originating action. This is suitable for most actions dealing with form input.
*
* We clear the page cache by default on an error as well, as we need to make sure the
* data is re-evaluated when the user changes something.
*