Skip to content

Instantly share code, notes, and snippets.

View olkunmustafa's full-sized avatar

olkunmustafa olkunmustafa

View GitHub Profile
<?php
if ( is_category() ) {
echo "<script>console.log( 'Cat ID : " . $cat . "' )</script>";
}
?>
public class Main {
public static void main(String[] args) {
List<String> afterdays = new ArrayList<String>();
List<String> beforeDays = new ArrayList<String>();
SimpleDateFormat df = new SimpleDateFormat( "dd-MM-yyyy" );
// Set edilmediği sürece bugün tarihini döner.
@olkunmustafa
olkunmustafa / SimpleBaseAdapter.java
Created July 11, 2016 17:58
It can be used creating new BaseAdapters. It makes easier the process.
package com.verisun.core;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import java.util.ArrayList;
public abstract class SimpleBaseAdapter<T> extends BaseAdapter {
@olkunmustafa
olkunmustafa / DoubleClickListener.java
Created July 12, 2016 06:48
Used As a lightweight alternative to GestureDetector you can use this class
public abstract class DoubleClickListener implements OnClickListener {
private static final long DOUBLE_CLICK_TIME_DELTA = 300;//milliseconds
long lastClickTime = 0;
@Override
public void onClick(View v) {
long clickTime = System.currentTimeMillis();
if (clickTime - lastClickTime < DOUBLE_CLICK_TIME_DELTA){
@olkunmustafa
olkunmustafa / SmoothScroll.java
Created July 12, 2016 08:09
Used when it is wanted to set selection listview with animation.
public void smootScroolListview() {
int duration = 300;//ms
int position = mListView.getFirstVisiblePosition();
int getHight = mListView.getHeight();
mListView.smoothScrollBy( ( ( getHight * position ) * -1 ), duration * 2 );
this.mListView.postDelayed( new Runnable() {
@Override
public void run() {
@olkunmustafa
olkunmustafa / DimensionHelper.java
Created August 13, 2016 05:08
Uses to convert to px from dip or vice versa.
package com.fallavi.android.utils;
import android.content.res.Resources;
import android.util.DisplayMetrics;
/**
* Created by olkunmustafa on 13/08/16
*
* Gives dimensions according to device's denisty
*/
// 9001 : Tüm alanlar doldurulmalı mesjaı verir.
// 9002 : Bu mail adresine ait bir kullanıcı zaten var.
// 9003 : Kayıt yapıldı ve değerler geri dönüldü.
var userName, mailAddress, password;
module.exports = {
post : function(request, response, next) {
userName = request.body.userName;
mailAddress = request.body.mailAddress;
// 9001 : Tüm alanlar doldurulmalı mesjaı verir.
// 9004 : Bu mail adresine ait bir kullanıcı yok!
// 9005 : Mail adresine ait kayıt geri dönüldü!
var mailAddress, userPass;
module.exports = {
get : function(request, response, next) {
mailAddress = request.query.mailAddress;
/**
* This filter uses to add new Header elements
* or it can be added new Log elements.
*
* @since 0.1.1
*/
private class ProgressFilter implements ServiceFilter {
/**
* @param request Request object
@olkunmustafa
olkunmustafa / me-contract endpoint
Created March 12, 2019 11:48
Json response when requested to me/contract endpoint.
{
"_links": {
"self": {
"href": "http://mapi.zingat.com/me/contract"
}
},
"_embedded": {
"contract": [
{
"id": 13411,