This file contains 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> | |
<form> | |
<Component v-for="({ type }, index) in schema" :key="index" :is="'v' + type" /> | |
</form> | |
</template> | |
<script> | |
export default { | |
components: { | |
vInput: () => import('@/components/form/Input' /* webpackChunkName: "components/form/Input" */), |
This file contains 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
[ | |
{ | |
"password": { | |
"iterations": 10 | |
}, | |
"username": null, | |
"role": "admin", | |
"provider": "email", | |
"token": null, | |
"resetToken": null, |
This file contains 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
{ | |
"data": { | |
"token": "123456" | |
} | |
} |
This file contains 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
{ | |
"data": { | |
"firstName": "Foo", | |
"lastName": "Bar", | |
"email": "foo@bar.com" | |
} | |
} |
This file contains 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 { Translate } = require('@google-cloud/translate').v2 | |
const translate = new Translate() | |
const text = 'Hello, world!' | |
const target = 'da' | |
async function translateText() { | |
// Translates the text into the target language. "text" can be a string for | |
// translating a single piece of text, or an array of strings for translating | |
// multiple texts. |
This file contains 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
{ | |
"data": { | |
"id": "5c70a48c318ce30ebd00c14c", | |
"type": "line_items", | |
"links": { | |
"self": "https://foo.example.com/api/line_items/5c70a48c318ce30ebd00c14c" | |
}, | |
"attributes": { | |
"type": "sku", | |
"sku": "7J237-410", |
This file contains 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> | |
<img :src="srcImage" :loading="loading" :alt="alt"> | |
</template> | |
<script> | |
export default { | |
props: { | |
src: { | |
type: Object, | |
default: () => ({ |
This file contains 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/bash | |
# . ./backup-files.sh from to | |
# Variables | |
WHAT=`date +%d%m%y%H%M%S`.tar.gz | |
WHERE=gs://$2/$WHAT | |
SMALLER_ARE_BETTER="tar -czvf $WHAT $1" | |
targz(){ |
This file contains 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
async function foo (method, url, body) { | |
if (!url) throw new Error() | |
let config = { | |
headers: { accept: 'application/json' } | |
} | |
if (method && body) { | |
config.body = JSON.stringify(body) | |
config.method = method | |
} | |
const res = await fetch(url, { config }) |
This file contains 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
export default function (func, wait, immediate) { | |
var timeout | |
return function() { | |
var context = this, args = arguments | |
var later = function() { | |
timeout = null | |
if (!immediate) func.apply(context, args) | |
} | |
var callNow = immediate && !timeout | |
clearTimeout(timeout) |