Skip to content

Instantly share code, notes, and snippets.

@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');
@scriptdev
scriptdev / .php
Last active April 19, 2024 01:31
GERAR PDF USANDO A CLASSE AdiantiHTMLDocumentParser
<?php
# CRIA A INSTANCIA DO HTML
$html = new AdiantiHTMLDocumentParser('app/resources/seu_documento.html');
# PEGA O HTML e ATRIBUI NA VARIÁVEL $documento PARA SER MANIPULADO
$documento = $html->getContents();
# CRIA AS ARRAYs COM OS PARÂMETRO PRA SER SUBSTITUÍDOS NO HTML
$antes = array('{empresa_nome}', '{empresa_celular}');
$depois = array($empresa_nome, $empresa_celular);
@scriptdev
scriptdev / .php
Created February 14, 2024 03:40
OBTER O DIA DA SEMANA ( PHP )
<?php
$dia_semana = date('N');
print_r($dia_semana);
/*
1 segunda
2 terça
3 quarta
4 quinta
@scriptdev
scriptdev / .php
Created February 15, 2024 23:00
EXTRAIR NOME e EXTENSÃO DO ARQUIVO (PHP)
<?php
public function BaixarArquivo($param = null)
{
try
{
$arquivo = $param['arquivo']; # app/output/contrato.pdf
$nome = pathinfo($arquivo, PATHINFO_FILENAME); # contrato
$extensao = pathinfo($arquivo, PATHINFO_EXTENSION); # .pdf
@KurtJacobson
KurtJacobson / building_lcnc.md
Last active April 19, 2024 01:29
Building LinuxCNC RIP from source

Building LinuxCNC RIP

Clone the source:
git@github.com:LinuxCNC/linuxcnc.git linuxcnc-dev

Configure:
$ cd linuxcnc-dev
$ cd debian
$ ./configure sim