What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-08-29 11:11:01
react usememo
/* A common use case is to access a child imperatively: */ function TextInputWithFocusButton() { const inputEl = useRef(null); const onButtonClick = () => { // `current` points to the mounted text input element inputEl.current.focus(); ... Add solution -
Javascript 2021-08-29 10:36:01
node wait 10 seconds
async function init() { console.log(1); await sleep(1000); console.log(2); } function sleep(ms) { return new Promise((resolve) => { setTimeout(resolve, ms); }); } // one liner let sleep = ms => new Promise(resolve => setTimeout(re... Add solution -
Python 2021-08-29 10:35:02
colon in python function
#It's a function annotation; function arguments and the return value can be tagged with arbitrary Python expressions. Python itself ignores the annotation (other than saving it), but third-party tools can make use of them. #In this case, it is intended a... Add solution -
VBA 2021-08-29 10:08:02
excel vba count words
'Fast VBA function to count the words in a string. Words are delimited by 'white space. White space is ASCII 0 thru 32. Function WordCount&(s$) Dim i&, b() As Byte If 0 = LenB(s) Then Exit Function b = s If b(0) > 32 Then WordC... Add solution -
Html 2021-08-29 09:58:02
how to make a clear button in javascript
<script> function clear_inputs(){ inputs=document.getElementsByClassName('inputs') for(input of inputs){ input.value=' ' ///this emptys the inputs } } </script> <input class='inputs' type="text"> <input ... Add solution -
Javascript 2021-08-29 09:46:02
how the map function works javascript
const posts = [ { id: 1, title: "Sample Title 1", description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit..." }, { id: 2, title: "Sample Title 2", description: "Lorem ipsum dolor sit amet, consectetur a... Add solution