Skip to content

Instantly share code, notes, and snippets.

View nesterchung's full-sized avatar

Nester Chung nesterchung

View GitHub Profile
@nesterchung
nesterchung / regex.kt
Last active March 31, 2022 03:22
snack case match
const val snackCaseMatcher = "([a-z]+(_[a-z]+)+)"
@nesterchung
nesterchung / Android Lollipop Widget Tinting Guide
Created January 31, 2019 02:52 — forked from seanKenkeremath/Android Lollipop Widget Tinting Guide
How base colors in Lollipop apply to different UI elements
Unless specified otherwise, all of the below tinting applies to both Lollipop and pre-Lollipop using AppCompat v21. To use the support version of these attributes, remove the android namespace. For instance, "android:colorControlNormal" becomes "colorControlNormal". These attributes will be propagated to their corresponding attributes within the android namespace for devices running Lollipop. Any exceptions to this will be noted by including the "android:" prefix.
All Clickable Views:
-----------
* ripple effect (Lollipop only) -- "colorControlHighlight"
Status Bar:
------------
* background (Lollipop only) - "colorPrimaryDark"
@nesterchung
nesterchung / LeakSlackUploadService.java
Created November 28, 2018 15:44 — forked from pyricau/LeakSlackUploadService.java
Sending Leak Traces to a Slack Channel (and HipChat, see the comments)
import android.util.Log;
import com.squareup.leakcanary.AnalysisResult;
import com.squareup.leakcanary.DisplayLeakService;
import com.squareup.leakcanary.HeapDump;
import retrofit.RestAdapter;
import retrofit.RetrofitError;
import retrofit.http.Multipart;
import retrofit.http.POST;
import retrofit.http.Part;
import retrofit.mime.TypedFile;
@nesterchung
nesterchung / getData.kt
Created September 14, 2018 14:57 — forked from ZherebtsovAlexandr/getData.kt
Integration Realm DataBase и kotlinx.coroutines
fun getData() = produce<List<Data>>(LooperThread) {
var results = realm.where(Data::class.java).findAll()
send(map(results))
results.addChangeListener { results ->
run {
launch(LooperThread) {
send(map(results))
}
}
}
@nesterchung
nesterchung / themes-debug.xml
Created September 14, 2018 03:18 — forked from dlew/themes-debug.xml
With the new theming in AppCompat, a lot of assets are tinted automatically for you via theme attributes. That has often led me to wonder "where the hell did this color come from?" You can replace your normal theme with this debug theme to help figure out the source of that color.
<!-- You can change the parent around to whatever you normally use -->
<style name="DebugColors" parent="Theme.AppCompat">
<!-- System colors -->
<item name="android:windowBackground">@color/__debugWindowBackground</item>
<item name="android:colorPressedHighlight">#FF4400</item>
<item name="android:colorLongPressedHighlight">#FF0044</item>
<item name="android:colorFocusedHighlight">#44FF00</item>
<item name="android:colorActivatedHighlight">#00FF44</item>
import java.net.*;
import java.io.*;
/**
* Echo socket client
*/
public class Servce {
public static void main(String[] args) {
//open server socket on port 1234
try {
A good commit message looks like this:
Header line: explaining the commit in one line
Body of commit message is a few lines of text, explaining things
in more detail, possibly giving some background about the issue
being fixed, etc etc.
The body of the commit message can be several paragraphs, and
please do proper word-wrap and keep columns shorter than about
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# File : gist:bff41ad90bcf130c022fe9ad7792c711/strings_translate.py
# Author : Nester Chung <twntwn3838@gmail>
# Date : 09.08.2018
# Last Modified Date: 10.08.2018
# Please install module before use this script:
# localizable
# googletrans
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# File : gist:2f2acad6fce7ebc8baff1288633309d7/xliff_translate.py
# Author : Nester Chung <twntwn3838@gmail>
# Date : 09.08.2018
# Last Modified Date: 10.08.2018
# Please install module before use this script:
# lxml
# googletrans
#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1