Skip to content

Instantly share code, notes, and snippets.

View kamontat's full-sized avatar
💭
I may be slow to respond.

Kamontat Chantrachirathumrong kamontat

💭
I may be slow to respond.
View GitHub Profile
@kamontat
kamontat / index.html
Last active November 25, 2016 11:17
Young Webmaster Camp(YWC) Homework(HW)
<!DOCTYPE html>
<html lang='en'>
<head>
<!-- Latest compiled and minified CSS -->
<link rel='stylesheet' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css' integrity='sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u' crossorigin='anonymous'>
<!-- Optional theme -->
<link rel='stylesheet' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css' integrity='sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp' crossorigin='anonymous'>
<!-- jquery of google CDN -->
<script src='https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js'></script>
@kamontat
kamontat / Checker.java
Last active March 6, 2017 17:23
Check Number in TextField
/**
* The checker to check string can or can't change to number.
*
* @author kamontat
* @version 1.0
* @since Mon 06/Mar/2017 - 7:39 PM
*/
public class Checker {
/**
* check input string must contains digit and <b>dot</b> ONLY.
@kamontat
kamontat / DimensionUtilities.java
Last active March 7, 2017 04:25
deal with display location
package com.view.gui.lib;
import java.awt.*;
/**
* utilities with dimension and screen display.
*
* @author kamontat
* @version 1.3
* @since 1/30/2017 AD - 1:47 PM
#!/bin/bash
# go to current directory
cd "$(dirname "$0")"
@kamontat
kamontat / Stopwatch.java
Last active April 26, 2017 16:51
To calculate time runner when run the code
import java.util.*;
import java.util.concurrent.TimeUnit;
/**
* timer/stopwatch object that for measure elapsed time running in java.
* <p>
* Contains
* <ol>
* <li>parse timer api: {@link #MStoS(long)} or {@link #NStoS(long)}</li>
* <li>Error message: {@link #getError()} or {@link #getErrors()}</li>
@kamontat
kamontat / base64.bash
Last active May 12, 2017 11:33
encode and decode str with base64
#!/bin/bash
INPUT=false
ACTION=""
CODE=""
while getopts 'iD:E:h' flag; do
case "${flag}" in
i) INPUT=true ;;
D) ACTION="D" && CODE="$OPTARG" ;;
#!/bin/bash
# make sure that you give permission to this file
# run chmod 755 atom-plugin.sh
# or chmod +x atom-plugin.sh
# -----------------------------------------
# command setting
if ! command -v apm >/dev/null 2>&1 && ! command -v apm-beta >/dev/null 2>&1; then
echo "you don't have commandline interface, install it!"
@kamontat
kamontat / Annotation.kt
Last active July 10, 2017 10:20
medium source code
// file name unnecessary to match with annotation name
// Target must matching (if not you will cannot get from annotations)
@Target(AnnotationTarget.VALUE_PARAMETER)
annotation class JsonKey(val key: String)
@kamontat
kamontat / GHObjectBuilder.kt
Last active July 10, 2017 10:37
medium source code
object GHObjectBuilder {
// build function
fun <T : Any> build(tClass: KClass<T>, json: JsonObject): T? {
// check primary constructor
if (tClass.primaryConstructor == null) return null
// create parameter mapping
val map: HashMap<KParameter, Any?> = HashMap<KParameter, Any?>()
// for each paramete in constructor
tClass.primaryConstructor!!.parameters.forEach {
param ->
filter.lfs.required=true
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
user.name=kamontat
user.email=kamontat_c@hotmail.com
core.excludesfile=/Users/kamontat/.gitignore_global
core.autocrlf=input
difftool.sourcetree.cmd=opendiff "$LOCAL" "$REMOTE"
difftool.sourcetree.path=