设置 git config --global http.https://git.521000.best.proxy socks5://127.0.0.1:1086
设置完成后, ~/.gitconfig 文件中会增加以下条目:
[http "https://github.com"]
proxy = socks5://127.0.0.1:1086
| fun <T> Flow<T>.throttle(waitMillis: Int) = flow { | |
| coroutineScope { | |
| val context = coroutineContext | |
| var nextMillis = 0L | |
| var delayPost: Deferred<Unit>? = null | |
| collect { | |
| val current = SystemClock.uptimeMillis() | |
| if (nextMillis < current) { | |
| nextMillis = current + waitMillis |
| import { getInitialState, syncLocalStorageWithRedux } from './util-localStorage' | |
| const reduxStorageKey = 'my-application:' | |
| const ONE_SECOND = 1000 | |
| const ONE_MINUTE = ONE_SECOND * 60 | |
| const ONE_HOUR = ONE_MINUTE * 60 | |
| const ONE_DAY = ONE_HOUR * 24 | |
| const ONE_YEAR = ONE_DAY * 365 | |
| // create a white list. key is the redux store key, and lifeSpan is |
| //convert gson String to Map<K, V>. Crash when invalid structure found | |
| inline fun <reified K, reified V> String.toMapByGson(): Map<K, V> = if (isNotEmpty()) { | |
| Gson().fromJson<HashMap<K, V>>(this, TypeToken.getParameterized(HashMap::class.java, K::class.java, V::class.java).type) | |
| } else { | |
| mapOf<K, V>() | |
| } | |
| //convert gson String to List<T>. Crash when invalid structure found | |
| inline fun <reified T> String.toListByGson(): List<T> = if (isNotEmpty()) { | |
| Gson().fromJson<List<T>>(this, TypeToken.getParameterized(ArrayList::class.java, T::class.java).type) |
| package main | |
| import ( | |
| "fmt" | |
| "log" | |
| "strings" | |
| "github.com/PuerkitoBio/goquery" | |
| ) |
| // for multiple requests | |
| let isRefreshing = false; | |
| let failedQueue = []; | |
| const processQueue = (error, token = null) => { | |
| failedQueue.forEach(prom => { | |
| if (error) { | |
| prom.reject(error); | |
| } else { | |
| prom.resolve(token); |
| import android.arch.lifecycle.GenericLifecycleObserver | |
| import android.arch.lifecycle.Lifecycle | |
| import android.arch.lifecycle.Lifecycle.Event.ON_DESTROY | |
| import android.arch.lifecycle.LifecycleOwner | |
| import kotlinx.coroutines.experimental.CoroutineScope | |
| import kotlinx.coroutines.experimental.Dispatchers | |
| import kotlinx.coroutines.experimental.Job | |
| import kotlinx.coroutines.experimental.android.Main | |
| fun Lifecycle.createJob(cancelEvent: Lifecycle.Event = ON_DESTROY): Job { |
| package org.tanrabad.survey.larvaecam | |
| import android.app.Fragment | |
| import android.content.Context | |
| import android.os.AsyncTask | |
| import android.os.Handler | |
| import android.os.Looper | |
| import android.view.View | |
| inline fun Context.runOnWorkerThread(crossinline task: () -> Unit) { |