Skip to content

Instantly share code, notes, and snippets.

View Tanapruk's full-sized avatar
🎯
Focusing

Tanapruk Tanapruk

🎯
Focusing
View GitHub Profile
@Tanapruk
Tanapruk / compile.md
Last active July 16, 2018 05:44
Truffle Studies

Compile

run truffle compile

All files that end with .sol in /contracts are turned into .json files in /build/contracts.

@Tanapruk
Tanapruk / lesson1note.md
Last active July 4, 2018 17:23
CryptoZombies

Lesson 1

Keywords

  • contract {} is for wrapping ethereum contract.
  • uint is no plus/minus integer.
  • struct {} is for wrapping multiple-attribute data. E.g.,
struct Zombie {
  string name;
 uint dna;

SharedElementTransition between Transition

When you open another activity and want to have a small picture (a view) inside a button animate to a big profile picture. That picture is called shared element.

  • Create a Scene that holds view and transitionName. Pack them inside Bundle and send it to another Activity. The destination view's xml must have android:transitionName attribute.

Origin

@Tanapruk
Tanapruk / dockernote.md
Last active July 14, 2017 09:01
Docker Workshop

Pull Image

docker pull <imagename>

Watch All Images

docker images

First Init

  • -d = run in background (daemon)
  • -p = map our PC's port 7200 to Docker 3000 port
  • --name = image name
@Tanapruk
Tanapruk / offline.md
Last active July 12, 2017 05:01
Gradle Offline in local.properties

build.gradle

apply from: "offline.gradle"

offline.gradle

Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
def isOffline = properties.getProperty('isoffline')
@Tanapruk
Tanapruk / activity.java
Created June 23, 2017 04:50
Unfocus EditText when taping outside
edittext.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (!hasFocus) {
Log.d("focus", "focus loosed");
// Do whatever you want here
} else {
Log.d("focus", "focused");
}
}
/*
* Copyright (C) 2017 The Android Open Source Project
*
* 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
@Tanapruk
Tanapruk / gitpullalllocal.sh
Last active March 28, 2017 14:23
Looping through all local git branch and git pull them each
function gitPullAllLocal() {
#if there is a passing argument
if [ -z $1 ]
then
GIT_RELATIVE_DIRECTORY="$(pwd)"
else
GIT_RELATIVE_DIRECTORY=$1
fi
#go to that relative path if exists
@Tanapruk
Tanapruk / gitpullalllocal.sh
Created March 28, 2017 14:20
Looping through all local git branch and git pull them each
function gitPullAllLocal() {
#if there is a passing argument
if [ -z $1 ]
then
GIT_RELATIVE_DIRECTORY="$(pwd)"
else
GIT_RELATIVE_DIRECTORY=$1
fi
#go to that relative path if exists
@Tanapruk
Tanapruk / vscode.md
Last active March 26, 2017 02:17
My Initial Setting on VSCode

VSCode Note

Workspace Settings

{
    "terminal.external.osxExec": "iTerm2.app",
    "terminal.integrated.fontFamily": "Meslo LG L DZ for Powerline",
    "terminal.integrated.lineHeight": 1.6,
    "terminal.integrated.fontSize": 12,
 "javascript.validate.enable": false,