View vite.config.js
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
import path from 'node:path' | |
import { loadEnv } from 'vite' | |
export default ({ mode }) => { | |
return { | |
env: Object.assign(process.env, loadEnv(mode, process.cwd())) | |
} | |
} |
View index.mjs
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
import { createServer } from 'node:http' | |
import { createHmac } from 'node:crypto' | |
import { Printer, InMemory, Drawer, Style, Align, Model } from 'escpos-buffer' | |
const { | |
PORT = 3000, | |
HOST = 0, | |
GITHUB_WEBHOOK_SECRET, | |
PRINTER_MODEL = 'TM-T20', | |
PRINTER_COLUMNS = 56 |
View i18n.js
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 (locale, path, ...args) { | |
return (path, ...args) => { | |
const keys = path.trim().split('.') | |
const fn = keys.reduce((prev, curr) => prev && prev[curr], locale) | |
return typeof fn === 'function' ? fn(...args) : fn | |
} | |
} | |
// export default function(t,e,...n){return(e,...n)=>{const r=e.trim().split(".").reduce((t,e)=>t&&t[e],t);return"function"==typeof r?r(...n):r}} |
View functions.php
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
<?php | |
add_filter('rest_pre_echo_response', function($response, $object, $request) { | |
$post_id = $response['id']; | |
$type = get_post_type($post_id); | |
$from_post = $request->get_param('from_post'); | |
if ($from_post && $type === 'hotels') { | |
pll_set_post_language($post_id, 'de'); | |
pll_set_post_language($from_post, 'en'); | |
pll_save_post_translations(array( |
View vitals.js
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 transformer = options => ({ | |
apply: 'post', | |
transform({ code, isBuild }) { | |
if (!isBuild) return code | |
return code.replace('</body>', `<script defer type="module"> | |
const KEY = 'ga:user' | |
const UID = (localStorage[KEY] = localStorage[KEY] || Math.random() + '.' + Math.random()) | |
const onError = err => console.error('[vite vitals] ', err) | |
const onDebug = (label, payload) => console.log(label, payload) |
View _page.vue
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> | |
<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
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
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) | |
} | |
}) |
View localhost.sh
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
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
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
alias foo=npm audit --json | grep '"type":"auditAdvisory"' | jq -r '{(.data.advisory.module_name):.data.advisory.patched_versions}' | jq -s add |
View script.sh
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
npm pack && tar -xvzf *.tgz && rm -rf package *.tgz |
NewerOlder