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
export class uuid { | |
static long() { | |
return uuid.fromBase('xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx') | |
} | |
static short() { | |
return uuid.fromBase('xxxxxxxx') | |
} | |
private static fromBase(base: string) { | |
return base.replace(/[xy]/g, (c) => { | |
const r = (Math.random() * 16) | 0 |
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 { MatDialog } from '@angular/material/dialog'; | |
import { ConfirmDialogComponent } from '@webdev/ui'; | |
import { Injector } from '@angular/core'; | |
/** | |
* Decorator para dialog de confirmação | |
* @param message | |
*/ | |
export function Confirmador(message: string) { | |
/** |
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
#!/bin/bash | |
# Para usar, dê permissão de execução ao script | |
# usando o comando: chmod +x create-project.sh | |
# e então execute: ./create-project.sh projeto | |
mkdir $1 | |
cd $1 | |
npm init -y |
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
export interface DayDataSet extends DOMStringMap { | |
date: string; | |
month: string; | |
year: string | |
monthName: string | |
} | |
interface DayCell extends HTMLTableCellElement { | |
dataset: DayDataSet | |
} |
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
<!doctype html> | |
<html lang="pt-br"> | |
<head> | |
<meta charset="utf-8" /> | |
<title>Cubo 3D</title> | |
<style> | |
.edge { | |
fill: white; | |
stroke: black; |
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
export function getForrmAsJson<R>(form: HTMLFormElement) { | |
const data = new FormData(form) | |
const value = Object.fromEntries(data.entries()) as Record<string, any> | |
Object.keys(value).forEach((key) => { | |
value[key] = !isNaN(+value[key]) ? +value[key] : value[key] | |
}) | |
return value as R |
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
/** | |
* You may copy, distribute and modify the software | |
* as long as you track changes/dates in source files. | |
* | |
* Guilherme Siquinelli <[email protected]> | |
* Copyleft (ↄ) 2022 - LGPL-3.0 | |
*/ | |
export type IdSelector = | |
| `#${string}` |
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 { HttpMethod, HttpRequestMap } from '../types' | |
export function fetchConfig<M extends HttpMethod>( | |
method: M, | |
opts: HttpRequestMap[M] | |
): RequestInit { | |
let { body, data, headers = [] } = opts | |
if (body) body = JSON.stringify(body) | |
if (data) data = JSON.stringify(data) |
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
const synth = speechSynthesis; | |
let vsort = -1; | |
let voices = []; | |
function createIA(lang, pitch, rate) { | |
if (voices.length === 0) { | |
voices = synth.getVoices().filter((v) => v.lang === lang); | |
} |
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
export type IdSelector = | |
| `#${string}` | |
| `#${string} ${string}` | |
| `#${string} > ${string}` | |
| `${string}#${string}`; | |
export type ClassSelector = | |
| `.${string}` | |
| `.${string} .${string}` | |
| `.${string} > .${string}` |