This file contains hidden or 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
| let count = 0 | |
| try { | |
| console.log(await waitFor(async () => { | |
| console.log('cb: sleep', await sleep(100)) | |
| return ++count == 3 | |
| })) | |
| } catch (e) { | |
| console.log(e) | |
| } |
This file contains hidden or 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
| <template> | |
| <!-- | |
| First things first, the `:value` cannot be `v-model="value"` because it would | |
| break reactivity. It's the same as assigning things directly to `value.value` | |
| and as explained below, assigning the value needs to be done through the host | |
| element (`host.value = '...'`). | |
| Secondly, the `<select>` element emits its own `input` event that bubbles. | |
| Unfortunately, the event is disguised under the custom element, and not the | |
| `<select>` that actually triggered the value. This is due to the `shadowRoot` |
This file contains hidden or 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
| #!/bin/sh | |
| # ------------------------------------------------------------------- | |
| # Headless VirtualBox installation script with PhpVirtualBox | |
| # ------------------------------------------------------------------- | |
| # 1. Add VirtualBox source | |
| echo "deb http://download.virtualbox.org/virtualbox/debian precise contrib" > virtualbox.list | |
| sudo mv virtualbox.list /etc/apt/sources.list.d/ | |
| wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | sudo apt-key add - |
This file contains hidden or 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 { pipeline } from 'stream/promises' | |
| const sleep = ms => new Promise(resolve => setTimeout(resolve, ms)) | |
| const colorsGenerator = async function* () { | |
| const values = [ 'yellow', 'orange', 'red', 'blue', 'purple', 'green' ] | |
| for await (const color of values) { | |
| yield color | |
| await sleep(1000) |
This file contains hidden or 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
| Entering CLI Mode, type 'exit' to return, or 'help' | |
| # dump | |
| # version | |
| # INAV/OMNIBUS 1.8.0 Nov 1 2017 / 06:14:28 (912d1315) | |
| # resources |
This file contains hidden or 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
| // All credits goes to http://stackoverflow.com/users/572129/senthil | |
| // http://stackoverflow.com/questions/5711084/java-runtime-getruntime-getting-output-from-executing-a-command-line-program | |
| Runtime rt = Runtime.getRuntime(); | |
| String[] commands = { "system.exe", "-get t" }; | |
| Process proc = rt.exec(commands); | |
| BufferedReader stdInput = new BufferedReader(new | |
| InputStreamReader(proc.getInputStream())); | |
| String s = null; |
This file contains hidden or 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
| /** | |
| * Create an array by calling an initializer on each element | |
| * | |
| * @param length {Number} length of the created array | |
| * @param init {Function} callback to call on each element of the array | |
| */ | |
| function array(length, init = index => 0) { | |
| return Array.apply(null, { length }).map(Function.call, init) | |
| } |
This file contains hidden or 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
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Document</title> | |
| <style> | |
| * { | |
| box-sizing: border-box; |
NewerOlder