Skip to content

Instantly share code, notes, and snippets.

View piruin's full-sized avatar
🎯
Focusing

Piruin Panichphol piruin

🎯
Focusing
View GitHub Profile

Hex Opacity Values

  • 100% — FF
  • 95% — F2
  • 90% — E6
  • 85% — D9
  • 80% — CC
  • 75% — BF
  • 70% — B3
  • 65% — A6
@piruin
piruin / Nillable.java
Created April 28, 2017 07:44
GSON's JsonAdapter for handle `{ @nil:true }` in tranfromed JSON from XML
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParseException;
import java.lang.reflect.Type;
class Nillable<T> implements JsonDeserializer<T> {
@Override
@piruin
piruin / nectec-apache-2.0
Created November 7, 2015 09:12
Intellij IDEA copyright profiles of NECTEC's Apache 2.0 License in Velocity templates
Copyright (c) $today.year NECTEC
National Electronics and Computer Technology Center, Thailand
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
@piruin
piruin / start.bat
Created September 9, 2016 03:21
batch file to start multiple jar instance
@echo off
start "api-9001" java -Dfile.encoding=UTF8 -Dlog4j.configurationFile=log4j2.xml -jar faarmis-api-1.0.jar -port 9001
start "api-9002" java -Dfile.encoding=UTF8 -Dlog4j.configurationFile=log4j2.xml -jar faarmis-api-1.0.jar -port 9002
start "api-9003" java -Dfile.encoding=UTF8 -Dlog4j.configurationFile=log4j2.xml -jar faarmis-api-1.0.jar -port 9003
@piruin
piruin / ThaichoteMapTile.java
Last active June 8, 2016 16:11
Caching version of ThaichoteMapTile
/*
* Copyright (c) 2016 NECTEC
* National Electronics and Computer Technology Center, Thailand
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@piruin
piruin / ThaichoteMapTile.java
Last active June 8, 2016 15:45
Class provide map tiles from ThaiChote satellite's image to use with Google Maps API V2 for Android
/*
* Copyright (c) 2016 NECTEC
* National Electronics and Computer Technology Center, Thailand
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@piruin
piruin / system-or-localproperties.gradle
Last active April 12, 2016 07:10
Gradle get property from system variable or local.properties
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
sendbirdAppId = System.hasProperty("SENDBIRD_APP_ID") ? System.getenv('SENDBIRD_APP_ID') : properties.getProperty("sendbird.app-id")
sendbirdApiToken = System.hasProperty("SENDBIRD_API_TOKEN") ? System.getenv('SENDBIRD_API_TOKEN') : properties.getProperty("sendbird.api-token")
@piruin
piruin / AndroidManifest.xml
Created February 24, 2016 09:20
Authen Demo
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.webViewTest"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="15"/>
<uses-permission android:name="android.permission.INTERNET"/>
<application android:label="@string/app_name" android:icon="@drawable/ic_launcher">
<activity android:name=".LoginActivity"
android:theme="@android:style/Theme.Holo.Light.Dialog"
@piruin
piruin / AndroidManifest.xml
Created February 24, 2016 08:43
Web View Test
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.webViewTest"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="15"/>
<uses-permission android:name="android.permission.INTERNET"/>
<application android:label="@string/app_name" android:icon="@drawable/ic_launcher">
<activity android:name="MyActivity"
android:theme="@android:style/Theme.Holo.Light.Dialog"
@piruin
piruin / post-building.json
Last active January 28, 2016 08:19
Tanrabad Api Post body sample
{
"building_id":"5cf5665b-5642-10fb-a3a0-5e612a842583",
"place_id":"5cf5665b-5642-10fb-a3a0-5e612a842584",
"place_type_id":4,
"name":"214/43",
"location":{
"type": "Point",
"coordinates": [73.150050, 39.745673]
},
"update_by":"dcp-user"