Skip to content

Instantly share code, notes, and snippets.

@daliborgogic
daliborgogic / _page.vue
Last active Sep 3, 2020
[POC] Dynamic component by current route
View _page.vue
<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' */),
View main.js
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 Jun 3, 2020
The simplest way to generate a private key and self-signed certificate for localhost is with this openssl.
View localhost.sh
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")
View .aliases
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
Want to find out what files npm will publish into the tarball without actually publishing?
View script.sh
npm pack && tar -xvzf *.tgz && rm -rf package *.tgz
View nuxt.config.js
export default {
plugins: ['~/plugins/vitals.client.js']
}
View users.md
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
View towns.js
export default [
'Aabenraa',
'Aalborg',
'Aarhus',
'Allerød',
'Assens',
'Ballerup',
'Billund',
'Bornholm',
'Brøndby',
View zipcodes.js
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 Apr 14, 2020
Global Trade Identification Number (GTIN) WooCommerce
View functions.php
<?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>',
You can’t perform that action at this time.