See how a minor change to your commit message style can make you a better programmer.
Format: <type>(<scope>): <subject>
<scope>
is optional
alias clearpackages="find . -name 'node_modules' -type d -prune -exec rm -rf '{}' +" |
'use strict' | |
// Future versions of Hyper may add additional config options, | |
// which will not automatically be merged into this file. | |
// See https://hyper.is#cfg for all currently supported options. | |
module.exports = { | |
config: { | |
// choose either `'stable'` for receiving highly polished, | |
// or `'canary'` for less polished but more frequent updates | |
updateChannel: 'stable', | |
// default font size in pixels for all tabs |
I really liked @tjvantoll article Handling Failed HTTP Responses With fetch(). The one thing I found annoying with it, though, is that response.statusText
always returns the generic error message associated with the error code. Most APIs, however, will generally return some kind of useful, more human friendly message in the body.
Here's a modification that will capture this message. The key is that rather than throwing an error, you just throw the response and then process it in the catch
block to extract the message in the body:
fetch("/api/foo")
.then( response => {
if (!response.ok) { throw response }
return response.json() //we only get here if there is no error
})
# Backup | |
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql | |
# Restore | |
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE | |
user nginx; | |
worker_processes 1; | |
error_log /var/log/nginx/error.log warn; | |
pid /var/run/nginx.pid; | |
events { | |
worker_connections 1024; | |
} |
Anonymous UUID: 217AD8CA-3F97-8F7B-FC29-9D7E60A9765B | |
Wed Sep 4 19:33:49 2019 | |
*** Panic Report *** | |
panic(cpu 0 caller 0xffffff80012b8a8f): initproc exited -- exit reason namespace 2 subcode 0xa description: none | |
uuid info: | |
0x10f9e9000 uuid = <3eba447f-a546-366b-b302-8dc3b21a3e30> | |
0x10460b000 uuid = <ae67e27b-133c-3e19-b3e1-d8151233254d> |
var pesquisa = "Diogo So"; | |
var query = db | |
.ref('albuns') | |
.orderByChild('nome') | |
.startAt(pesquisa) | |
.endAt(pesquisa + "\uf8ff"); | |
query.on('value', function(snapshot){ | |
if (snapshot.val()){ |
{ "eventKey" : "LIKE", //REQUIRED String que representa o evento que gera o alerta | |
"loginReceiver" : "diogosm", //REQUIRED (alias, idpId or userCode) quem receberá o alerta | |
"priority" : "NORMAL", // Options: NONE (Doesn't send notification), LOW, NORMAL and HIGH | |
"object" : { // o objeto do alerta, como documento, postagem, imagem ou processo | |
"alertObjectId" : "1", // o número de identificação exclusivo do objeto | |
"alertObjectTypeDescriptionKey" : "Contract", // descrição do tipo de objeto | |
"alertObjectDescription" : "Agreement document", // a descrição do objeto mostrada no alerta | |
"alertObjectLink" : "/ecmnavigation?app_ecm_navigation_doc=7", // o link para acessar o objeto | |
"alertObjectDetailKey" : "from last Monday meeting", // (OPTIONAL) detalhes da chave | |
"alertObjectNote" : "Approved by the board members" // (OPTIONAL) a nota de objeto para informações extras, permite até 600 caracteres |
module.exports = function(ctx) { | |
// Se certifica de ter a plataforma android | |
if (ctx.opts.platforms.indexOf('android') < 0) { | |
return; | |
} | |
// Inicializa as dependencias nodejs | |
var fs = ctx.requireCordovaModule('fs'), | |
path = ctx.requireCordovaModule('path'), |