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 / _page.vue
Last active September 3, 2020 19:38
[POC] Dynamic component by current route
<template>
<Component :is="is" />
</template>
<script>
import layout from '@/helpers/layout'
const components = {
vBuilding: () => import('@/components/pages/Building.vue' /* webpackChunkName: `building` */),
vSeminaire: () => import('@/components/pages/Seminaire.vue' /* webpackChunkName: 'components/page/seminaire' */),
vCoaching: () => import('@/components/pages/Coaching.vue' /* webpackChunkName: 'components/page/coaching' */),
document.querySelectorAll('input[type=search]').forEach(input => {
input.addEventListener('mouseup', e => {
if (input.value.length > 0) {
setTimeout(() => {
if (input.value.length === 0) {
// do reset action here
}
}, 5)
}
})
@daliborgogic
daliborgogic / localhost.sh
Created June 3, 2020 17:18
The simplest way to generate a private key and self-signed certificate for localhost is with this openssl.
openssl req -x509 -out localhost.crt -keyout localhost.key \
-newkey rsa:2048 -nodes -sha256 \
-subj '/CN=localhost' -extensions EXT -config <( \
printf "[dn]\nCN=localhost\n[req]\ndistinguished_name = dn\n[EXT]\nsubjectAltName=DNS:localhost\nkeyUsage=digitalSignature\nextendedKeyUsage=serverAuth")
alias foo=npm audit --json | grep '"type":"auditAdvisory"' | jq -r '{(.data.advisory.module_name):.data.advisory.patched_versions}' | jq -s add
@daliborgogic
daliborgogic / script.sh
Created May 8, 2020 17:00
Want to find out what files npm will publish into the tarball without actually publishing?
npm pack && tar -xvzf *.tgz && rm -rf package *.tgz
@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>',