- Assert
- Calling
assert.fail()with more than one argument is deprecated. [70dcacd710] - Calling
assert.ok()with no arguments will now throw. [3cd7977a42] - Calling
assert.ifError()will now throw with any argument other thanundefinedornull. Previously the method would throw with any truthy value. [e65a6e81ef] - The
assert.rejects()andassert.doesNotReject()methods have been added for working with async functions. [599337f43e]
- Calling
- Async_hooks
- Older experimental async_hooks APIs have been removed. [
1cc6b993b9]
- Older experimental async_hooks APIs have been removed. [
- Buffer
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
| // database.js | |
| const MongoClient = require('mongodb').MongoClient; | |
| async function getConnection(server) { | |
| return await MongoClient.connect(server); | |
| } | |
| /** | |
| * @param {MongoClient} client - MongoClient instance! | |
| * @param {String} databaseName - The database name string |
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 getSomething() { | |
| return new Promise((resolve, reject) => setTimeout(() => resolve('Something'), 3000)); | |
| } | |
| function getAnotherThing() { | |
| return new Promise((resolve, reject) => setTimeout(() => resolve('Another thing'), 4000)); | |
| } | |
| function anotherMain() { | |
| return Promise.all([ |
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
| const MongoClient = require('mongodb').MongoClient; | |
| const assert = require('assert'); | |
| // Connection URL | |
| const url = 'mongodb://localhost:27017'; | |
| // Database name | |
| const dbName = 'myproject'; | |
| (async function() { | |
| try { |
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
| wget https://s3.amazonaws.com/assets.minecraft.net/pi/minecraft-pi-0.1.1.tar.gz . | |
| tar zxvf minecraft-pi-0.1.1.tar.gz |
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
| curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 && chmod +x minikube | |
| curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl && chmod +x kubectl | |
| export MINIKUBE_WANTUPDATENOTIFICATION=false | |
| export MINIKUBE_WANTREPORTERRORPROMPT=false | |
| export MINIKUBE_HOME=$HOME | |
| export CHANGE_MINIKUBE_NONE_USER=true | |
| mkdir $HOME/.kube || true | |
| touch $HOME/.kube/config |
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
| // Primeiro você precisa rodar npm i esprima escodegen | |
| const escodegen = require('escodegen'); | |
| const parser = require('esprima'); | |
| const fs = require('fs'); | |
| function processAst(astBody) { | |
| let currentElement; | |
| // Se esse elemento passado ainda não for o body da Arvore de Sintaxe Abstrata, | |
| // Chamamos a função recursivamente para pegar o body real; |
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 os | |
| import fnmatch | |
| def gen_find(filepat,top): | |
| for path, dirlist, filelist in os.walk(top): | |
| for name in fnmatch.filter(filelist,filepat): | |
| yield os.path.join(path,name) | |
| # Example use |
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
| const axios = require('axios'); | |
| module.exports = function(context, blob, outputBlob) { | |
| context.log(blob); | |
| axios.post( | |
| 'https://speech.platform.bing.com/speech/recognition/interactive/cognitiveservices/v1?language=pt-BR&format=detailed', | |
| blob, | |
| { | |
| headers: { | |
| 'Ocp-Apim-Subscription-Key': process.env.API_KEY, |
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 from this wonderful lib the constant equals to the Jupiter Mass (in KG) | |
| from astropy.constants import M_jup | |
| # if you don't want the library | |
| # M_jup = 10**27 | |
| def mj_to_kg(mj_value): | |
| raw_value = int(mj_value) | |
| return (raw_value + 0.00019) * M_jup | |