Skip to content

Instantly share code, notes, and snippets.

View dino-su's full-sized avatar

Dino Su dino-su

View GitHub Profile
@dino-su
dino-su / ClockText.kt
Created September 29, 2022 03:40
Compose TextClock
@Composable
fun ClockText() {
val currentTimeMillis = remember {
mutableStateOf(System.currentTimeMillis())
}
LaunchedEffect(key1 = currentTimeMillis) {
while (true) {
delay(250)
currentTimeMillis.value = System.currentTimeMillis()
@dino-su
dino-su / Jenkinsfile
Created March 18, 2021 08:24
Android Lint with Quality Gate.
pipeline {
agent any
stages {
stage('Git') {
steps {
git 'https://github.com/android/sunflower.git'
}
}
stage('Lint') {
@dino-su
dino-su / README.md
Last active June 8, 2020 03:15
Pocket 的延伸閱讀功能
@dino-su
dino-su / facebook.md
Created April 20, 2020 23:15
Remove Facebook AD perferences.
@dino-su
dino-su / wsl.md
Last active April 13, 2020 08:18
WSL Setup

Node

  • nvm: $ nvm install --lts
@dino-su
dino-su / ubuntu.md
Last active April 20, 2020 10:17
Ubuntu Setup

Bash

  • bash_profile: $ ln -s ~/src/dotfiles/bash_profile ~/.bash_profile

2020/3/23 安裝 snap 上的版本會無法輸入中文,直接安裝 deb 檔案則沒有這個問題。

@dino-su
dino-su / notepad.md
Last active March 4, 2020 02:14
Browser Notepad

Type the following code into the browser's URL bar.

data:text/html,

def project = jenkins.model.Jenkins.instance.getItemByFullName('PROJECT_NAME')
def build = project.getBuildByNumber(87)
build.@result = hudson.model.Result.SUCCESS
// build.@result = hudson.model.Result.NOT_BUILT
// build.@result = hudson.model.Result.UNSTABLE
// build.@result = hudson.model.Result.FAILURE
// build.@result = hudson.model.Result.ABORTED
@dino-su
dino-su / fibProxy.js
Last active May 7, 2019 01:26
Fibonacci Memoization
function proxy(fn) {
const cache = {};
return function (arg) {
// add function result to cache
if (cache[arg] === undefined) cache[arg] = fn.call(this, arg);
return cache[arg];
}
}
@dino-su
dino-su / promise-queue.js
Last active November 19, 2019 07:34
Fluent Promise Proxy
// Credit: https://gist.github.com/malko/d3dee36e7d0d927654439f4c01c8ca0c
function fluentProxy (target, promise = Promise.resolve()) {
return new Proxy(target, {
get(target, property) {
if (target[property] instanceof Function) {
return (...args) => fluentProxy(target, promise.then(() => target[property](...args)));
}
}
});