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 { existsSync } from 'node:fs'; | |
export async function importDefaultFunctionOrFunctionAsEdgeFunction(filePathOrFn: string | Function) { | |
let fnString = filePathOrFn; | |
if (typeof filePathOrFn === "string" && existsSync(filePathOrFn)) { | |
const { default: fn } = await import(filePathOrFn); | |
fnString = fn.toString(); | |
} |
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
FROM oven/bun:1-debian | |
ENV DBUS_SESSION_BUS_ADDRESS autolaunch: | |
# Install latest chrome dev package and fonts to support major charsets (Chinese, Japanese, Arabic, Hebrew, Thai and a few others) | |
# Note: this installs the necessary libs to make the bundled version of Chrome that Puppeteer | |
# installs, work. | |
RUN apt update -y | |
RUN apt install -y wget gnupg | |
RUN apt install -y \ |
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
#!/usr/bin/env bash | |
# GIT_USERNAME="" | |
GIT_PUBLIC_KEYS_AUTHORIZED_KEYS_FILE="${GIT_PUBLIC_KEYS_AUTHORIZED_KEYS_FILE:-${HOME}/.ssh/authorized_keys}" | |
GIT_PUBLIC_KEYS_START="## Start of git public keys" | |
GIT_PUBLIC_KEYS_STOP="## End of git public keys" | |
tmp_file=$(mktemp) | |
clean() { | |
rm -f "$tmp_file" "${GIT_PUBLIC_KEYS_AUTHORIZED_KEYS_FILE}.gitkeys" |
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
#!/usr/bin/env bash | |
if ! command -p sudo -n -v > /dev/null 2>&1; then | |
echo "Execute this script as admin by using sudo writing:" | |
echo " sudo !!" | |
echo | |
fi | |
# Update | |
apt update -y |
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
# You need to change last param of the resource url for your stop number | |
# You need to change "A" for whatever your line it is | |
# You can view all default params information stop here: | |
#. https://www.tua.es/es/lineas-y-horarios/paradas/uria-centro-1218.html?idLinea=6#paradasIda | |
# homeassistant: | |
# packages: | |
# rest: !include tua.yaml | |
input_text: |
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 hasGroup = typeof Object.groupBy === typeof undefined || typeof Array.groupToMap === typeof undefined || typeof Array.group === typeof undefined; | |
if (!hasGroup) { | |
const groupBy = (arr, callback) => { | |
return arr.reduce((acc = {}, ...args) => { | |
const key = callback(...args); | |
acc[key] ??= [] | |
acc[key].push(args[0]); | |
return acc; | |
}, {}); | |
}; |
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
/* Source: https://twitter.com/midudev/status/1652957687015940097 */ | |
background-color: Canvas; | |
color: CanvasText; | |
color-scheme: light dark; |
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
{ | |
"zschema": { | |
"prefix": "zschema", | |
"body": [ | |
"export const $1Schema = z.$2($3);", | |
"export type ${1/(.*)/${1:/pascalcase}/} = z.infer<typeof $1Schema>;", | |
"", | |
"$0" | |
], | |
"description": "Creates a function wrapper for a model's attribute." |
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
function isBun() { | |
return Boolean(globalThis.Bun); | |
} | |
function isDeno() { | |
return Boolean(globalThis.Deno); | |
} | |
function isNode() { | |
return Boolean(globalThis.process?.versions?.node); |
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
77 | |
export type RemoveUnderscoreFirstLetter<S extends string> = | |
S extends `${infer FirstLetter}${infer U}` | |
? `${FirstLetter extends '_' ? U : `${FirstLetter}${U}`}` | |
: S; | |
export type CamelToSnakeCase<S extends string> = | |
S extends `${infer T}${infer U}` | |
? `${T extends Capitalize<T> ? '_' : ''}${RemoveUnderscoreFirstLetter< | |
Lowercase<T> |
NewerOlder