Skip to content

Instantly share code, notes, and snippets.

View daliborgogic's full-sized avatar
:octocat:
In Git we trust!

Dalibor Gogic daliborgogic

:octocat:
In Git we trust!
View GitHub Profile
@daliborgogic
daliborgogic / nuxt.config.js
Last active May 8, 2020 11:42
[POC] Web Vitals for Nuxt.js https://web.dev/vitals/
export default {
plugins: ['~/plugins/vitals.client.js']
}
queue subscriber
user.write.app1 app1
user.created.app2 app2
user.behavior.app3 app3
exchange type binding_queue binding_key
user.write topic user.write.app1 user.*
user.write topic user.created.app2 user.created
export default [
'Aabenraa',
'Aalborg',
'Aarhus',
'Allerød',
'Assens',
'Ballerup',
'Billund',
'Bornholm',
'Brøndby',
export default [
['Aabenraa', 6200],
['Aabybro', 9440],
['Aakirkeby', 3720],
['Aalborg', 9000],
['Aalborg SV', 9200],
['Aalborg SØ', 9210],
['Aalborg Øst', 9220],
['Aalestrup', 9620],
['Aarhus C', 8000],
@daliborgogic
daliborgogic / functions.php
Created April 14, 2020 07:09
Global Trade Identification Number (GTIN) WooCommerce
<?php
/**
* Global Trade Identification Numbers (GTINs) to WooCommerce products.
* Render the Global Trade Identification Number (GTIN) meta field.
*/
function woocommerce_render_gtin_field() {
$input = array(
'id' => '_gtin',
'label' => sprintf(
'<abbr title="%1$s">%2$s</abbr>',
@daliborgogic
daliborgogic / form.vue
Last active March 27, 2020 18:39
Dynamic Components
<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" */),
[
{
"password": {
"iterations": 10
},
"username": null,
"role": "admin",
"provider": "email",
"token": null,
"resetToken": null,
{
"data": {
"token": "123456"
}
}
{
"data": {
"firstName": "Foo",
"lastName": "Bar",
"email": "[email protected]"
}
}
@daliborgogic
daliborgogic / translate.js
Last active January 9, 2020 09:36
Cloud Translation v2
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.