Skip to content

Instantly share code, notes, and snippets.

Eric Li ericksli

Block or report user

Report or block ericksli

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ericksli
ericksli / adb.md
Created Jul 26, 2019
Android ADB enable/disable animation
View adb.md

Disable animation

adb shell settings put global window_animation_scale 0
adb shell settings put global transition_animation_scale 0
adb shell settings put global animator_duration_scale 0

Enable animation

@ericksli
ericksli / android-default-datetime-format.md
Last active Jun 11, 2019
Android default date and time formats
View android-default-datetime-format.md

Android Default Date and Time Formats

Sample Timestamps

Name Timestamp (millisecond) Human-readable form
Timestamp A 1557086889000 Monday, 6 May 2019 04:08:09 GMT+08:00
Timestamp B 1571984435000 Friday, 25 October 2019 14:20:35 GMT+08:00

12-hour Format

@ericksli
ericksli / Mail merge.csv
Last active Apr 13, 2019
Google Apps Script mail merge
View Mail merge.csv
Email Name Prize Sent By Sent At
test1@example.com Atlas Cantu Google Pixel 3
test2@example.com Keir James Huawei Mate 20 Pro
test3@example.com Rhianne Kendall Samsung Galaxy Note 9
test4@example.com Lillie-Rose Hahn Sony Xperia XZ3
test5@example.com Leyton Zamora LG G7 ThinQ
@ericksli
ericksli / latecert.js
Created Feb 10, 2019
Fill in the MTR late cert form usling puppeteer.
View latecert.js
const puppeteer = require('puppeteer');
const readline = require('readline');
const sleep = require('util').promisify(setTimeout);
require('dotenv').config();
const EVENT_SELECTOR = 'select#ddlEvent';
const NAME_SELECTOR = 'input#username';
const EMAIL_SELECTOR = 'input#email';
const CAPTCHA_SELECTOR = 'input#captcha-form';
@ericksli
ericksli / Calendar Template.html
Created Oct 17, 2018
Google Apps Script create calendar events
View Calendar Template.html
<b>英文名:</b> <?= enTitle ?>
<br><b>中文名:</b> <?= zhTitle ?>
@ericksli
ericksli / DemoActivity.kt
Last active Sep 3, 2018
Simplify the creation of ViewModel #android #kotlin
View DemoActivity.kt
class DemoActivity : AppCompatActivity() {
private lateinit var viewModel: MyViewModel
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
viewModel = viewModel(MyViewModel.Factory(application))
setContentView(R.layout.activity_demo)
}
}
@ericksli
ericksli / ReactNativeExtensions.kt
Last active Aug 29, 2019
React Native Kotlin extension functions for creating WritableMap and WritableArray #android #react-native #kotlin
View ReactNativeExtensions.kt
import com.facebook.react.bridge.Arguments
import com.facebook.react.bridge.WritableArray
import com.facebook.react.bridge.WritableMap
fun writableMapOf(vararg values: Pair<String, *>): WritableMap {
val map = Arguments.createMap()
for ((key, value) in values) {
when (value) {
null -> map.putNull(key)
is Boolean -> map.putBoolean(key, value)
@ericksli
ericksli / DividerItemDecoration.kt
Last active Sep 3, 2018
Draw bottom divider in RecyclerView with customisable show/hide divider and paddings for each item #android
View DividerItemDecoration.kt
import android.content.Context
import android.graphics.Canvas
import android.graphics.Paint
import android.graphics.RectF
import android.support.annotation.ColorRes
import android.support.v4.content.res.ResourcesCompat
import android.support.v4.view.ViewCompat
import android.support.v7.widget.RecyclerView
import org.jetbrains.anko.dip
@ericksli
ericksli / lr-station-platform.json
Last active Sep 2, 2017
Hong Kong MTR Light Rail stations and platforms
View lr-station-platform.json
[
{
"code": "001",
"initial": "FEP",
"titleZh": "屯門碼頭",
"titleEn": "Tuen Mun Ferry Pier",
"latitude": 22.37284525,
"longitude": 113.9661371,
"fareZone": "1",
"platforms": [
@ericksli
ericksli / SemVer.kt
Last active Jun 18, 2017
Kotlin data object for Semantic Versioning (SemVer) 2.0.0 specification
View SemVer.kt
/**
* Version number in [Semantic Versioning 2.0.0](http://semver.org/spec/v2.0.0.html) specification (SemVer).
*
* @property major major version, increment it when you make incompatible API changes.
* @property minor minor version, increment it when you add functionality in a backwards-compatible manner.
* @property patch patch version, increment it when you make backwards-compatible bug fixes.
* @property preRelease pre-release version.
* @property buildMetadata build metadata.
*/
data class SemVer(
You can’t perform that action at this time.