This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"singleQuote": true, | |
"trailingComma": "es5", | |
"tabWidth": 2, | |
"useTabs": false, | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const recursiveCall = (index) => | |
new Promise((resolve) => { | |
console.log(index); | |
if (index < 3) { | |
return resolve(recursiveCall(++index)); | |
} else { | |
return resolve(); | |
} | |
}) | |
recursiveCall(0).then(() => console.log('done')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Globals | |
unsigned long previousMillis = 0; | |
const long eventInterval = 5000; | |
// ... | |
// Blocking "like delay()" | |
unsigned long start = millis(); | |
while (millis() - start <= eventInterval) { | |
// ... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import axios from 'axios'; | |
const jsonify = (resp) => resp.data; | |
const fetcher = (url) => axios.get(url).then(jsonify); | |
export { jsonify, fetcher }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"terminal.integrated.profiles.windows": { | |
"Git Bash": { | |
"path": "%AppData%\\Local\\Programs\\Git\\git-bash.exe" | |
} | |
}, | |
"terminal.integrated.defaultProfile.windows": "Git Bash", | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const jsonify = (resp) => resp.json(); | |
const fetcher = (url) => fetch(url).then(jsonify); | |
export { jsonify, fetcher }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useState } from 'react'; | |
const useDisclose = (initiallyOpen = false) => { | |
const [isOpen, setIsOpen] = useState(initiallyOpen); | |
return { | |
isOpen, | |
onOpen: () => setIsOpen(true), | |
onClose: () => setIsOpen(false), | |
onToggle: () => setIsOpen((state) => !state), | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useReducer } from 'react'; | |
const useForceUpdate = () => useReducer((s) => s + 1, 0); | |
export { useForceUpdate }; | |
// const [forceUpdate, setForceUpdate] = useForceUpdate(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const makePromise = (condition) => { | |
return new Promise((resolve, reject) => { | |
condition | |
? resolve('I am surely going to get resolved!') | |
: reject('Something is not right!') | |
}) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const int relayPin = D6; | |
const long interval = 2000; | |
void setup() { | |
Serial.begin(115200); | |
pinMode(relayPin, OUTPUT); | |
} | |
void loop() { | |
digitalWrite(relayPin, HIGH); |
OlderNewer