Skip to content

Instantly share code, notes, and snippets.

@scriptdev
scriptdev / .php
Created December 19, 2023 03:20
CONVERTER ARRAY EM OBJETO ( PHP )
<?php
$data = (object) $param;
@scriptdev
scriptdev / .php
Created December 19, 2023 17:34
ATUALIZAR DINAMICAMENTE O TDBMultiSearch
<?php
public function onSave($param = null)
{
TDBMultiSearch::reloadFromModel('form_VendaForm', 'cliente_id', self::$database, "Cliente", 'id', 'nome','nome asc');
TForm::sendData('form_VendaForm', (object)['cliente_id' => $object->id], false, false);
}
@scriptdev
scriptdev / .php
Created December 20, 2023 16:55
CRIAR CIRCULO NA COLUNA DO DATAGRID
<?php
$cor = '#F44336'; # VERMELHO
if ($value < 0)
{
$valor = 'R$ ' . number_format($value,2,',','.');
$html = "<span style = 'height:20px;width: 20px; background-color:". $cor .";border-radius: 50%;display: inline-block;'>$valor</span>";
} else {
@scriptdev
scriptdev / .html
Created December 25, 2023 23:21
ABRIR LINK EM OUTRA ABA DO NAVEGADOR
<a href="https://wa.me/5583986556461" target="_blank">
<i class="fab fa-whatsapp"></i>Whatsapp (83) 98655-6461
</a>
@scriptdev
scriptdev / .php
Created January 15, 2024 15:56
FILTRAR CAMPO DE OUTRA TABELA NA LISTAGEM
<?php
public function onSearch($param = null)
{
$data = $this->form->getData();
$filters = [];
TSession::setValue(__CLASS__.'_filter_data', NULL);
TSession::setValue(__CLASS__.'_filters', NULL);
@scriptdev
scriptdev / .php
Created January 15, 2024 22:40
CRIAR MENSAGEM ( SystemMessage )
<?php
TTransaction::open('communication');
$data = $this->form->getData();
$this->form->validate();
$object = new SystemMessage;
$object->system_user_id = TSession::getValue('userid');
$object->system_user_to_id = $data->system_user_destino_id;
@scriptdev
scriptdev / .php
Created January 22, 2024 00:17
ADICIONAR IMAGEM CENTRALIZADA NO WelcomeView
<?php
# HTML IMAGEM CENTRALIZADA NA PÁGINA
<!--[main]-->
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
@padeoe
padeoe / README_hfd.md
Last active April 19, 2024 01:33
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.
@scriptdev
scriptdev / .php
Created January 27, 2024 23:49
DEFINIR BOTÃO SALVAR "onSave" COMO ESTÁTICO
<?php
# ESTÁTICO ['static' => 1]
$btn_onsave = $this->form->addAction("SALVAR", new TAction([$this, 'onSave'],['static' => 1]), 'fas:save #000000');
# NÃO ESTÁTICO
$btn_onsave = $this->form->addAction("SALVAR", new TAction([$this, 'onSave']), 'fas:save #000000');