Skip to content

Instantly share code, notes, and snippets.

View piruin's full-sized avatar
🎯
Focusing

Piruin Panichphol piruin

🎯
Focusing
View GitHub Profile
#!/usr/bin/env bash
# Script to download asset file from tag release using GitHub API v3.
# See: http://stackoverflow.com/a/35688093/55075
CWD="$(cd -P -- "$(dirname -- "$0")" && pwd -P)"
# Check dependencies.
set -e
type curl grep sed tr >&2
xargs=$(which gxargs || which xargs)
@piruin
piruin / csv2xml4odoo.py
Last active May 30, 2023 11:02 — forked from bealdav/csv2xml4odoo.py
Odoo csv / xml converter
# -*- coding: utf-8 -*-
# based on this code
# http://code.activestate.com/recipes/577423-convert-csv-to-xml/
# convert Odoo csv files in xml files
# csv is easy to maintain but xml data have noupdate feature
# Limitations:
# - relation field One2many is NOT supported
# - csv should have 'id' as first column
@piruin
piruin / settings.json
Created May 8, 2018 04:58
VS Code's user setting of mine
{
"editor.fontLigatures": true,
"editor.fontFamily": "Fira Code",
"editor.fontSize": 16,
"files.insertFinalNewline": true,
"workbench.colorTheme": "Default Light+",
"workbench.iconTheme": "vscode-icons",
@piruin
piruin / update-gradlew-permission.bat
Created February 19, 2018 09:51
fix gradlew permission on windows
git update-index --chmod=+x gradlew
@piruin
piruin / AndroidThread.kt
Created October 30, 2017 09:41
Kotlin's Extension for Easy Handler Thread
package org.tanrabad.survey.larvaecam
import android.app.Fragment
import android.content.Context
import android.os.AsyncTask
import android.os.Handler
import android.os.Looper
import android.view.View
inline fun Context.runOnWorkerThread(crossinline task: () -> Unit) {

Hex Opacity Values

  • 100% — FF
  • 95% — F2
  • 90% — E6
  • 85% — D9
  • 80% — CC
  • 75% — BF
  • 70% — B3
  • 65% — A6
@piruin
piruin / DrawableCompat.kt
Last active May 3, 2023 13:09
Kotlin Extension for set/get compound Drawable to TextView/EditText/Button as property
/*
* Copyright 2017 Piruin Panichphol
*
* 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 / 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-copyright-template
Last active March 31, 2021 19:53
NECTEC Copyright (Velocity) template for Intellij IDEA and Android Studio
@piruin
piruin / colors.xml
Created November 21, 2016 12:49
Material Design Color Palette Colors.xml Resource file for Android
<?xml version="1.0" encoding="utf-8"?>
<!--
Google Material Design Color Palette for Android http://www.google.com/design/spec/style/color.html#color-ui-color-palette
Spreadsheet used to create this reosurce - http://bit.ly/mdcolor_spreadsheet
Link to this colors.xml resource file - http://bit.ly/mdcolorsxml
Harshad Kale
https://github.com/kalehv
harshad.kale@gmail.com