await
causes the function to pause until a Promise is fulfilled or rejected, and to resume execution of the async function after fulfillment. When resumed, the value of the await expression is that of the fulfilled Promise.- If the Promise is rejected, the await expression throws the rejected value.
- If the value of the expression following the await operator is not a Promise, it's converted to a resolved Promise.
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 SwiftUI | |
import AVKit | |
struct VideoPlayerControls: View { | |
let player: AVPlayer | |
@Binding var currentTime: CGFloat | |
var height: CGFloat = 50 |
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
function switchgo() { | |
version=$1 | |
if [ -z $version ]; then | |
echo "Usage: switchgo [version]" | |
return | |
fi | |
if ! command -v "go$version" > /dev/null 2>&1; then | |
echo "version does not exist, download with: " | |
echo " go get golang.org/dl/${version}" |
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
$ cat test.js | |
function foo () { while (true) { } } | |
function bar () { return foo(); } | |
bar(); | |
$ node test.js & | |
$ gdb attach $(pidof node) | |
0x00000bf778c63d5f in ?? () | |
(gdb) b v8::internal::Runtime_StackGuard | |
Breakpoint 1 at 0x84a1f0 | |
(gdb) print 'v8::V8::TerminateExecution'(0) |
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
package main | |
import ( | |
"database/sql" | |
"fmt" | |
"net/url" | |
"os" | |
"reflect" | |
"regexp" | |
"strconv" |
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
#!/usr/bin/env node | |
const fs = require('fs'); | |
const path = require('path'); | |
const execSync = require('child_process').execSync; | |
if (process.argv.length < 3) { | |
console.log(`node ${path.relative('.', process.argv[1])} [DevToolsProfile]`); | |
process.exit(1); | |
} | |
let traceFile = path.resolve(process.argv[2]) |
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
To benchmark: | |
go test -bench=".*" > machine_description.txt |
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
module.exports = function(grunt) { | |
'use strict'; | |
require('grunt-horde') | |
.create(grunt) | |
.demand('initConfig.projName', 'conjure') | |
.demand('initConfig.instanceName', 'conjure') | |
.demand('initConfig.klassName', 'Conjure') | |
.loot('node-component-grunt') | |
.loot('node-lib-grunt') |
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
module.exports = function(grunt) { // Intent: extend patterns seeded by a more universal module ... | |
this.demand( | |
'initConfig.jshint.src.files.src', | |
this.learn('initConfig.jshint.src.files.src').concat('bin/cli.js') | |
); | |
}; | |
module.exports = function(grunt) { // Intent: ... or redefine them | |
return { | |
src: { |
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
module.exports = function(grunt) { | |
require('grunt-horde') | |
.create(grunt) | |
.loot('module-one') | |
.loot('module-two') | |
.loot('./config/grunt') | |
.attack(); | |
}; |