Skip to content

Instantly share code, notes, and snippets.

Bahadır AKIN bhdrkn

Block or report user

Report or block bhdrkn

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View CxfServerTestRule.java
import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider;
import org.apache.cxf.endpoint.Server;
import org.apache.cxf.feature.LoggingFeature;
import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
import org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider;
import org.junit.rules.ExternalResource;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@bhdrkn
bhdrkn / MyApplication.java
Created Mar 14, 2016
Example Android Application with OkHTTP and Retrofit with Caching
View MyApplication.java
import android.app.Application;
import android.util.Log;
import com.bahadirakin.service.UserService;
import com.bahadirakin.util.Constants;
import com.bahadirakin.util.LoggingInterceptor;
import com.bahadirakin.util.NetworkUtil;
import com.squareup.okhttp.Cache;
import com.squareup.okhttp.OkHttpClient;
import retrofit.RequestInterceptor;
import retrofit.RestAdapter;
View LoggingInterceptor.java
import com.squareup.okhttp.Interceptor;
import com.squareup.okhttp.Request;
import com.squareup.okhttp.Response;
import java.io.IOException;
import java.util.concurrent.atomic.AtomicLong;
public class LoggingInterceptor implements Interceptor {
@bhdrkn
bhdrkn / App.java
Created Feb 9, 2016
AWS S3 Example
View App.java
import com.amazonaws.auth.AWSCredentials;
import com.amazonaws.auth.PropertiesCredentials;
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.AmazonS3Client;
import com.amazonaws.services.s3.model.Bucket;
import com.amazonaws.services.s3.model.DeleteObjectsRequest;
import com.amazonaws.services.s3.model.ObjectListing;
import com.amazonaws.services.s3.model.ObjectMetadata;
import com.amazonaws.services.s3.model.PutObjectResult;
import com.amazonaws.services.s3.model.S3Object;
@bhdrkn
bhdrkn / Vagrantfile
Created Jul 5, 2015
Redis Vagrantfile
View Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby ts=2 sw=2 expandtab:
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.network "private_network", ip: "192.168.33.10"
config.vm.provision "shell", inline: <<-SHELL
apt-get update
apt-get install build-essential
apt-get install tcl8.5
@bhdrkn
bhdrkn / Vagrantfile
Last active Aug 29, 2015
RabbitMQ Vagrant
View Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby ts=2 sw=2 expandtab:
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.network "private_network", ip: "192.168.33.10"
config.vm.provision "shell", inline: <<-SHELL
echo 'deb http://www.rabbitmq.com/debian/ testing main' >/etc/apt/sources.list.d/rabbitmq.list
wget http://www.rabbitmq.com/rabbitmq-signing-key-public.asc
apt-key add rabbitmq-signing-key-public.asc
@bhdrkn
bhdrkn / rabbitmq.config
Created Jun 24, 2015
Simple RabbitMQ Config for Development
View rabbitmq.config
%% -*- mode: erlang -*-
[
{rabbit,
[
{tcp_listeners, [5672]},
{log_levels, [{connection, info}, {channel, info}]},
{loopback_users, []},
{auth_mechanisms, ['PLAIN', 'AMQPLAIN']},
{default_vhost, <<"/">>},
{default_user, <<"guest">>},
@bhdrkn
bhdrkn / Okhttp-SystemOutInterceptor
Created Jun 16, 2015
Okhttp-SystemOutInterceptor
View Okhttp-SystemOutInterceptor
package com.bahadirakin.api;
import com.squareup.okhttp.Interceptor;
import com.squareup.okhttp.Request;
import com.squareup.okhttp.Response;
import java.io.IOException;
import java.util.concurrent.atomic.AtomicLong;
/**
View gist:d53f15858dd304b33542
ObjectMapper mapper = new ObjectMapper();
mapper.setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY);
mapper.setVisibility(PropertyAccessor.SETTER, JsonAutoDetect.Visibility.NONE);
mapper.setVisibility(PropertyAccessor.GETTER, JsonAutoDetect.Visibility.NONE),
// map...
@bhdrkn
bhdrkn / gist:7aea7046ff7c02947f36
Created May 14, 2015
mvn clean verify -X output
View gist:7aea7046ff7c02947f36
Apache Maven 3.2.3 (33f8c3e1027c3ddde99d3cdebad2656a31e8fdf4; 2014-08-11T23:58:10+03:00)
Maven home: /usr/local/Cellar/maven/3.2.3/libexec
Java version: 1.7.0_25, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_25.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.10.3", arch: "x86_64", family: "mac"
[INFO] Error stacktraces are turned on.
[DEBUG] Reading global settings from /usr/local/Cellar/maven/3.2.3/libexec/conf/settings.xml
[DEBUG] Reading user settings from /Users/bhdrkn/.m2/settings.xml
[DEBUG] Using local repository at /Users/bhdrkn/.m2/repository
You can’t perform that action at this time.