A kotlin script producing a fibunacci range inspired by clovisai's contribution to kotlin discussion: Project Loom will make coroutines obsolete.
val fibonacci = sequence {
yield(1)
var cur = 1
var next = 1
while (true) {
#!/bin/bash | |
set -euo pipefail | |
IFS=$'\n\t' | |
find . -maxdepth 2 -type d -name .git -execdir sh -c "pwd && git pull" \; |
#!/bin/bash | |
# http://redsymbol.net/articles/unofficial-bash-strict-mode/ | |
set -euo pipefail | |
IFS=$'\n\t' | |
EXCLUDED_PACKAGES=("package1" "package2" "package3") | |
while [[ `brew list | wc -l` -ne 0 ]]; do | |
for EACH in `brew list`; do | |
if [[ ! " ${EXCLUDED_PACKAGES[@]} " =~ " ${EACH} " ]]; then |
apg -m 6 -x 20 -a0 -M NCLS -l -t -n 15 | |
# -m [min_length] | |
# -x [max_length] | |
# -a0 [Random password generation with all characters] | |
# -M NCLS: Use specific character sets: | |
# - N: Include numeric digits (0-9). | |
# - C: Include uppercase alphabetic characters (A-Z). | |
# - L: Include lowercase alphabetic characters (a-z). | |
# - S: Special characters (!@#$%^&*() and others). |
A kotlin script producing a fibunacci range inspired by clovisai's contribution to kotlin discussion: Project Loom will make coroutines obsolete.
val fibonacci = sequence {
yield(1)
var cur = 1
var next = 1
while (true) {
#run the code | |
./gradlew run | |
# output: | |
dotdotRange: a,b,c,d | |
untilRange: a,b,c | |
untilRange new 1.7.20: a,b,c | |
rangeTo: a,b,c,d | |
downTo: d,c,b,a |
val A_UNTIL_D = ('a' until 'd') | |
// a,b,c | |
@OptIn(ExperimentalStdlibApi::class) | |
val A_NEW_UNTIL_D = ('a' ..< 'd') | |
// a,b,c |
..< |
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach { | |
kotlinOptions { languageVersion = "1.8" } | |
} |
// please see also the accompanying blog post | |
// https://www.lotharschulz.info/2021/10/14/how-to-create-a-react-frontend-to-debounce-text-input-persistence-in-firebase-firestore/ | |
function Elements() { | |
const defaultDelayInMillis = 5000; // default delay 5 seconds | |
const [dbValue, setDBValue] = useState(""); | |
const [delayFieldDisabled, setdelayFieldDisabled] = useState(true) | |
const [debounceDelay, setDebounceDelay] = useState(defaultDelayInMillis) | |
const collectionLabel = "data"; |
// please see also the accompanying blog post | |
// https://www.lotharschulz.info/2021/10/14/how-to-create-a-react-frontend-to-debounce-text-input-persistence-in-firebase-firestore/ | |
const saveFieldValueDebounced = AwesomeDebouncePromise( | |
saveFieldValue, | |
debounceDelay, | |
{ key: fieldId => fieldId }, | |
); | |
const saveFieldValue = (fieldId: number, fieldValue: string) => saveToDB(fieldValue); |