Standard escape codes are prefixed with Escape
:
- Ctrl-Key:
^[
- Octal:
\033
- Unicode:
\u001b
- Hexadecimal:
\x1B
- Decimal:
27
//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) { |
This text is the section about OS X Yosemite (which also works for macOS Sierra) from https://docs.basho.com/riak/kv/2.1.4/using/performance/open-files-limit/#mac-os-x
The last time i visited this link it was dead (403), so I cloned it here from the latest snapshot in Archive.org's Wayback Machine https://web.archive.org/web/20170523131633/https://docs.basho.com/riak/kv/2.1.4/using/performance/open-files-limit/
package main | |
import ( | |
"bytes" | |
"fmt" | |
"strings" | |
"io/ioutil" | |
"os" | |
"path" |