Skip to content

Instantly share code, notes, and snippets.

View guangtuan's full-sized avatar
🎯
Focusing

guangtuan

🎯
Focusing
View GitHub Profile
@guangtuan
guangtuan / Dockerfile
Created September 1, 2021 03:50
jenkins
FROM jesusperales/jenkins-docker-run-inside:latest
ADD sdk.tar.gz /root/android-sdk
USER root
ENV JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF-8"
ENV JENKINS_OPTS="--httpPort=80"
ENV LANG C.UTF-8
ENV TZ=Asia/Shanghai
ENV ANDROID_HOME=/root/android-sdk
@guangtuan
guangtuan / global.sh
Last active May 20, 2021 09:36
global setting for local development
export ES_HOME=/path/to/elasticsearch-7.12.1
alias ping='ping -c 5'
alias wget='wget -c'
alias tf="tail -500f"
alias c="clear"
alias grep='grep --color=auto'
alias ssh="ssh -o 'ServerAliveInterval 60'"
alias q="exit"
alias untar="tar -zxvf"
@guangtuan
guangtuan / notion_ext.js
Last active January 31, 2021 11:42
demo of ramda usage
const {
compose,
not,
prop,
ifElse,
map,
flip,
zipObj,
chain,
zipWith,
@guangtuan
guangtuan / TextStoreUtil.java
Created September 30, 2020 08:28
TextStoreUtil
package cn.agilean.valuekanban.shared;
import org.springframework.stereotype.Component;
import java.nio.charset.StandardCharsets;
public class TextStoreUtil {
private int defaultMaxByteCountOfText = 500;
@guangtuan
guangtuan / WebServiceProvider.java
Created December 2, 2019 01:08
WebServiceProvider
package cn.agilean.valuekanban.sync.protrait;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.http.HttpMethod;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@guangtuan
guangtuan / commit-msg.sh
Created August 23, 2019 13:18
pre-check git commit message
#!/bin/sh
MSG=$(cat $1)
if ! [[ "$MSG" =~ ^#[0-9]{4} ]];then
echo "Your commit message must starts with a story number, like "#1234""
exit 1
fi
@guangtuan
guangtuan / compose-async.js
Last active July 9, 2019 13:08
compose-async
function isAsync(fn) {
return fn.constructor.name === 'AsyncFunction';
}
const compose = (...fns) => {
let containsAsync = false;
return function (param) {
let result = param;
while (fns.length) {
let currentFn = fns.shift();
@guangtuan
guangtuan / makeItPointfree.js
Created July 5, 2019 15:05
makeItPointfree
const pointfree = prototypeOrFunc => {
if (typeof prototypeOrFunc === 'function') {
if (isConstructor(prototypeOrFunc)) {
return (...args) => new prototypeOrFunc(...args);
} else {
return (...args) => prototypeOrFunc.bind(args.shift())(...args);
}
}
const Type = {};
Object.getOwnPropertyNames(prototypeOrFunc).forEach(func => {
@guangtuan
guangtuan / hideSubscriptionProblems.js
Last active July 21, 2019 15:09
hideSubscriptionProblems
// ==UserScript==
// @name hide subscription problem on leetcode
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://leetcode.com/problemset/*/
// @grant none
// ==/UserScript==
@guangtuan
guangtuan / walkLinkedList.js
Last active June 6, 2019 12:53
recursive in JavaScript anonymous function
const head = {
val: 1,
next: {
val: 2,
next: {
val: 3
}
}
};