Skip to content

Instantly share code, notes, and snippets.

@scriptdev
scriptdev / .php
Created April 9, 2023 18:13
PERSONALIZAR A CAIXA DE DIÁLOGO TQuestion
<?php
new TQuestion("DESEJA SALVAR?", new TAction([__CLASS__, 'onYes'], $param), NULL, 'ATENÇÃO!','SIM','NÃO');
@scriptdev
scriptdev / .php
Last active April 19, 2024 03:19
ADICIONAR A IMAGEM NO TImage
<?php
$imagem = $object->imagem;
TScript::create("$('#img').attr('src', 'download.php?file={$imagem}')");
# COM LINK EXTERNO
TScript::create("$('#img').attr('src', '{$imagem}'");
# img É O ID DO COMPONENTE TImage
@scriptdev
scriptdev / .php
Created April 14, 2023 22:57
FOCA NA ABA DO FORMULÁRIO
<?php
TScript::create("$(\".tab-name:contains('DADOS PESSOAIS')\").click();");
# DADOS PESSOAIS É O NOME DA ABA
@MaxGabriel
MaxGabriel / parser.ts
Created September 24, 2018 20:27
Date parsing code
import * as P from 'parsimmon'
import Day from '~/utils/Day'
import Month from '~/utils/Month'
const shortMonths = {
jan: 1,
feb: 2,
mar: 3,
apr: 4,
may: 5,
@scriptdev
scriptdev / .php
Last active April 19, 2024 03:19
SALVAR E FOCAR O ÚLTIMO CLIQUE NA ABA DO FORMULÁRIO ( setTabAction )
<?php
public function __construct($param)
{
parent::__construct();
# CRIA A AÇÃO PARA EXECUTAR O MÉTODO QUE IRÁ SALVAR A TAB QUE O USUÁRIO SELECIONOU
$abaSelecionada = new TAction([$this, 'abaSelecionada']);
$this->form->setTabAction($abaSelecionada);
@scriptdev
scriptdev / .php
Last active April 19, 2024 03:18
DEFINIR O TEMPO LIMITE DE SESSÃO DO PHP
<?php
ini_set('session.gc_maxlifetime', 1800); # 1800 SEGUNDOS = 30 MINUTOS
session_start(); # INICIA A SESSÃO
# OU VIA php.ini
@scriptdev
scriptdev / .php
Last active April 19, 2024 03:18
PEGAR DADOS SEPARADOS DE UM TEXTO ( explode )
<?php
$nome_completo = 'FABRICIO ALMEIDA';
$array = explode(' ', $nome);
# RETORNO DO explode
Array
(
[0] => FABRICIO
@scriptdev
scriptdev / .php
Last active April 19, 2024 03:18
ESCONDER PARTE DO TEXTO EM PHP
<?php
class Funcao
{
public static function ocultarTexto($texto, $inicio, $tamanho) {
$oculta = str_repeat('*', $tamanho);
$retorno = substr($texto, 0, $inicio) . $oculta . substr($texto, $inicio + $tamanho);
return $retorno;
}
}
@scriptdev
scriptdev / .txt
Last active April 19, 2024 03:17
FONTES PARA APLICAÇÕES e RELATÓRIOS
Ubuntu
https://fonts.google.com/specimen/Ubuntu
Roboto Mono
https://fonts.google.com/specimen/Roboto+Mono
Source Sans Pro
https://fonts.google.com/specimen/Source+Sans+Pro
font-family: "Source Code Pro", monospace;
@padeoe
padeoe / README_hfd.md
Last active April 19, 2024 03:17
CLI-Tool for download Huggingface models and datasets with aria2/wget+git

🤗Huggingface Model Downloader

Considering the lack of multi-threaded download support in the official huggingface-cli, and the inadequate error handling in hf_transfer, this command-line tool smartly utilizes wget or aria2 for LFS files and git clone for the rest.

Features

  • ⏯️ Resume from breakpoint: You can re-run it or Ctrl+C anytime.
  • 🚀 Multi-threaded Download: Utilize multiple threads to speed up the download process.
  • 🚫 File Exclusion: Use --exclude or --include to skip or specify files, save time for models with duplicate formats (e.g., *.bin or *.safetensors).
  • 🔐 Auth Support: For gated models that require Huggingface login, use --hf_username and --hf_token to authenticate.
  • 🪞 Mirror Site Support: Set up with HF_ENDPOINT environment variable.