This file contains hidden or 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
function linearizeOutput<T, U, V>(fn: (this: V, ...args: T[]) => U, anyway?: () => Promise<void>) { | |
return async function (this: V, ...args: T[]): Promise<[Error, null] | [null, U]> { | |
try { | |
const result = await fn.call(this, ...args); | |
return [null, result]; | |
} | |
catch (err) { | |
const error = err instanceof Error ? err : new Error(err as string); | |
return [error, null]; | |
} finally { |
This file contains hidden or 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
Show hidden characters
{ | |
"Pinia Setup Store Boilerplate": { | |
"scope": "javascript,typescript", | |
"prefix": "pinia-setup", | |
"body": [ | |
"import { defineStore, acceptHMRUpdate } from 'pinia'", | |
"", | |
"export const use${TM_FILENAME_BASE/^(.*)$/${1:/pascalcase}/}Store = defineStore('$TM_FILENAME_BASE', () => {", | |
" $0", | |
" return {}", |
This file contains hidden or 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
{ | |
"[html]": { | |
"editor.defaultFormatter": "vscode.html-language-features" | |
}, | |
"[javascript]": { | |
"editor.defaultFormatter": "vscode.typescript-language-features" | |
// "editor.defaultFormatter": "vscode.typescript-language-features" | |
}, | |
"[json]": { | |
"editor.defaultFormatter": "vscode.json-language-features" |
This file contains hidden or 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 { exec } from 'node:child_process' | |
async function run (cmd) { | |
const child = exec(cmd, (err) => { | |
if (err) console.error(err) | |
}) | |
child.stderr.pipe(process.stderr) | |
child.stdout.pipe(process.stdout) | |
await new Promise((resolve) => child.on('close', resolve)) | |
} |
This file contains hidden or 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
/// <reference types="vitest" /> | |
import { URL, fileURLToPath } from 'node:url' | |
import process from 'node:process' | |
import { defineConfig } from 'vite' | |
import vue from '@vitejs/plugin-vue' | |
import svgLoader from 'vite-svg-loader' | |
import UnoCSS from 'unocss/vite' | |
import AutoImport from 'unplugin-auto-import/vite' | |
import Components from 'unplugin-vue-components/vite' |
This file contains hidden or 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
<script lang="ts" setup> | |
import { computed, onMounted, onUnmounted, ref, useSlots } from 'vue' | |
import { DsfrLogo, DsfrSearchBar, DsfrHeaderMenuLinks, type DsfrHeaderProps } from '@gouvminint/vue-dsfr' | |
const props = withDefaults(defineProps<DsfrHeaderProps>(), { | |
serviceTitle: undefined, | |
serviceDescription: undefined, | |
homeTo: '/', | |
logoText: () => 'Gouvernement', |
This file contains hidden or 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
# Check for a currently running instance of the agent | |
RUNNING_AGENT="`ps -ax | grep 'ssh-agent -s' | grep -v grep | wc -l | tr -d '[:space:]'`" | |
echo "RUNNING_AGENT: $RUNNING_AGENT" | |
if [ "$RUNNING_AGENT" = "0" ]; then | |
# Launch a new instance of the agent | |
ssh-agent -s &> ~/.ssh/ssh-agent | |
fi | |
eval `cat ~/.ssh/ssh-agent` |
This file contains hidden or 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
# If you come from bash you might have to change your $PATH. | |
# export PATH=$HOME/bin:/usr/local/bin:$PATH | |
# Path to your oh-my-zsh installation. | |
export ZSH="${HOME}/.oh-my-zsh" | |
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc. | |
# Initialization code that may require console input (password prompts, [y/n] | |
# confirmations, etc.) must go above this block; everything else may go below. | |
if test -n "${USE_P10K-}"; then |
This file contains hidden or 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
# Static files directory | |
root <%= ENV['STATIC_DIR'] || '/usr/share/nginx/html' %>; | |
index index.html; | |
location / { | |
try_files $uri $uri/ /index.html =404; | |
} | |
location /api { | |
rewrite "^(.*)$" $1 break; |
This file contains hidden or 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
# nginx.conf | |
user nginx; | |
worker_processes auto; | |
error_log /dev/stdout info; | |
pid /var/run/nginx.pid; | |
events { |
NewerOlder