Skip to content

Instantly share code, notes, and snippets.

View gokhanbarisaker's full-sized avatar

Gökhan Barış Aker gokhanbarisaker

  • Booking.com
  • Amsterdam
View GitHub Profile
@gokhanbarisaker
gokhanbarisaker / PicassoDecoder.java
Last active September 1, 2016 15:17
Picasso decoder for subsampling-scale-image-view
/**
* Created by gokhanbarisaker on 8/30/15.
*/
public class PicassoDecoder implements ImageDecoder
{
private String tag;
private Picasso picasso;
public PicassoDecoder(String tag, Picasso picasso) {
this.tag = tag;
@gokhanbarisaker
gokhanbarisaker / log.php
Created September 24, 2012 12:14
PHP log utility class for more descriptive logging...
<?php
//////////////////////////////////////////////////////////////////
//
// log.php
// Log
//
// Copyright 2012 Gökhan Barış Aker
//
// Licensed under the Apache License, Version 2.0 (the "License");
Observable.from(new Loggable[]{ new Foo(), new Bar() }).subscribe(new Subscriber<Loggable>() {
@Override
public void onCompleted() {}
@Override
public void onError(Throwable e) {}
@Override
public void onNext(Loggable loggable) {
loggable.log();
@gokhanbarisaker
gokhanbarisaker / characters
Created September 20, 2012 07:23
characters with navigation
public static String generateCharacterTagByIndex(int index)
{
return (Integer.toString(index + 14970));
}
class NavigatableEditText extends EditText
{
private WeakReference<View> navigationNext = null;
private WeakReference<View> navigationPrevious = null;
// Iterate through the localizedRuleNames in ruleResults and
// return an array of their strings.
function ruleList(results) {
// Your code goes here!
var rules = [];
var ruleResults = results.formattedResults.ruleResults;
for (var key in ruleResults) {
rules.push(ruleResults[key].localizedRuleName);
}
var moonWalkers = [
"Neil Armstrong",
"Buzz Aldrin",
"Pete Conrad",
"Alan Bean",
"Alan Shepard",
"Edgar Mitchell",
"David Scott",
"James Irwin",
"John Young",
function getRelationship(x, y) {
// Your code goes here!
var xValid = validateNumber(x);
var yValid = validateNumber(y);
if (xValid && yValid) {
return getRelationshipSymbol(x, y);
}
else if(xValid) {
@gokhanbarisaker
gokhanbarisaker / onDestroy
Created April 2, 2014 07:34
Android Activity onDestroy from 4.4.2-rc1 KitKat
/**
* Perform any final cleanup before an activity is destroyed. This can
* happen either because the activity is finishing (someone called
* {@link #finish} on it, or because the system is temporarily destroying
* this instance of the activity to save space. You can distinguish
* between these two scenarios with the {@link #isFinishing} method.
*
* <p><em>Note: do not count on this method being called as a place for
* saving data! For example, if an activity is editing data in a content
* provider, those edits should be committed in either {@link #onPause} or
@gokhanbarisaker
gokhanbarisaker / onStop
Created April 2, 2014 07:32
Android Activity onStop from 4.4.2-rc1 KitKat
/**
* Called when you are no longer visible to the user. You will next
* receive either {@link #onRestart}, {@link #onDestroy}, or nothing,
* depending on later user activity.
*
* <p>Note that this method may never be called, in low memory situations
* where the system does not have enough memory to keep your activity's
* process running after its {@link #onPause} method is called.
*
* <p><em>Derived classes must call through to the super class's
@gokhanbarisaker
gokhanbarisaker / onPause
Created April 2, 2014 07:31
Android Activity onPause from 4.4.2-rc1 KitKat
/**
* Called as part of the activity lifecycle when an activity is going into
* the background, but has not (yet) been killed. The counterpart to
* {@link #onResume}.
*
* <p>When activity B is launched in front of activity A, this callback will
* be invoked on A. B will not be created until A's {@link #onPause} returns,
* so be sure to not do anything lengthy here.
*
* <p>This callback is mostly used for saving any persistent state the