Skip to content

Instantly share code, notes, and snippets.

View g4rcez's full-sized avatar
🇧🇷
🎧

Allan Garcez g4rcez

🇧🇷
🎧
View GitHub Profile
@g4rcez
g4rcez / espanso.yml
Last active January 21, 2025 11:25
Configuração do espanso gerada pelo meu arquivo de configuração Typescript + Deno
matches:
- label: "Trigger: ;url\n\n\n \r```text\n \r$($HOME/.local/bin/mise which deno) run --allow-read $HOME/dotfiles/espanso/main.ts url --value \"$ESPANSO_CLIPBOARD\"\n \r```\n "
replace: '{{url}}'
trigger: ;url
vars:
- name: clipboard
type: clipboard
- name: url
params:
cmd: >-
import {
add,
set,
format,
startOfWeek,
endOfWeek,
eachDayOfInterval,
isBefore,
} from "npm:date-fns";
import { useSyncExternalStore } from "react";
type Fn<T> = (a: T) => unknown
class Store<T extends object> {
private snapshot: [state: T, instance: this];
private subscribers = new Set<Fn<T>>();
constructor(private state: T) {
this.snapshot = [this.state, this];
import { formToJson } from "brouther";
import React, { useCallback, useEffect, useRef, useState } from "react";
import { AllPaths, Is, setPath } from "sidekicker";
import { z, ZodArray, ZodNumber } from "zod";
import { formReset, InputProps } from "~/components";
export const convertPath = (path: string) => path.replace("[", ".").replace("]", "").split(".");
export const getSchemaShape = <T extends z.ZodObject<any>>(name: string, schema: T) =>
convertPath(name).reduce((acc, el) => {
import axios from "axios";
export type Country = {
name: Name;
tld?: string[];
cca2: string;
ccn3?: string;
cca3: string;
cioc?: string;
independent?: boolean;
export const initObserver = (root: HTMLElement) => {
const dataset = {
ga: "data-ga",
inspect: "data-inspect",
};
const observer = new MutationObserver((params) => {
params.forEach((node) => {
if (!(node.target as any).querySelectorAll) return [];
const htmlElement: HTMLElement = node.target as any;
import fs from "fs";
import ts from "typescript";
const isType = (node: ts.Node) =>
ts.isTypeAliasDeclaration(node) ||
(ts.isInterfaceDeclaration(node) && node.name && node.name);
type DocEntry = {
name?: string;
fileName?: string;
import { formatISO,parse } from "date-fns";
const getUtcDate = (date: Date) => {
const r = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}).(\d{3})/;
const [, ...s] = r.exec(date.toISOString())!;
return (Date.UTC as any)(...s);
};
const parseFromFormat = (strDate: string, format: string) => {
const p = parse("2020.10.06 09:24:06", "yyyy.MM.dd HH:mm:ss", new Date());
const utc = getUtcDate(p);
import { assocPath } from "ramda";
import { useClassNames } from "hulks";
import React, {
Fragment,
useCallback,
useEffect,
useMemo,
useState,
} from "react";
import { Arrow } from "./arrow";
import axios, { AxiosInstance, AxiosRequestConfig, AxiosStatic, CancelTokenSource } from "axios";
import { useCallback, useEffect, useMemo, useRef } from "react";
type Tokens = { [k: string]: CancelTokenSource | undefined };
const createUid = () => Math.random().toString(36).substring(16);
type Http = "get" | "head" | "options" | "delete";
type HttpBody = "post" | "put" | "patch";