Skip to content

Instantly share code, notes, and snippets.

@Kautenja
Kautenja / tar-progress.md
Last active April 20, 2024 00:28
one-liners for using tar with gzip and pv for a progress bar

Compress

tar cf - <files> -P | pv -s $(du -sb <files> | awk '{print $1}') | gzip > <some .tar.gz file>

where:

  • `` is the root-mounted (i.e. starts with /) path to the files
@scriptdev
scriptdev / .php
Last active April 20, 2024 00:27
BUSCAR O ENDEREÇO PELO CEP
<?php
ini_set('display_errors',0);
class PessoaForm extends TPage
{
public static function onCEP($param = null)
{
try
@scriptdev
scriptdev / .php
Last active April 20, 2024 00:25
DEFINE MÁSCARA NO CAMPO
<?php
// COM true, IRÁ SALVAR SEM A MÁSCARA DO CAMPO
$telefone->setMask('(99) 9999-9999', true);
TEntry::changeMask(self::$formName, 'cpf', '999.999.999-99');
TEntry::changeMask(self::$formName, 'cnpj', '999.999.999-99');
@scriptdev
scriptdev / .php
Last active April 20, 2024 00:23
MUDA A MÁSCARA DO CAMPO CPF/CNPJ AO SELECIONAR O TIPO DE PESSOA DA COMBO
<?php
// DEFININDO A AÇÃO DA COMBOX TIPO PESSOA AO MUDAR DE OPÇÃO
$tipo_pessoa->setChangeAction(new TAction([$this,'onTipoPessoa']));
// cpf_cnpj É O NOME DO CAMPO CPF / CNPJ
// FUNÇÃO DA COMBO TIPO PESSOA
public static function onTipoPessoa($param = null)
{
@scriptdev
scriptdev / .php
Last active April 20, 2024 00:23
BUSCA O CNPJ E MOSTRA OS DADOS DA EMPRESA NO FORMULÁRIO
<?php
public static function buscarEmpresa($param = null)
{
if ($param['cnpj'])
{
$cnpj = str_replace(['.','-','/',' '],['','','',''], $param['cnpj']);
$content = file_get_contents("https://www.receitaws.com.br/v1/cnpj/{$cnpj}", false, stream_context_create([
"ssl" => [
@scriptdev
scriptdev / .php
Last active April 20, 2024 00:21
CRIAR FILTRO DOS REGISTROS PELA UNIDADE LOGADA NO DATAGRID
<?php
# VIA CONSTRUCT
$this->datagrid = new BootstrapDatagridWrapper($this->datagrid);
$this->filter_criteria = new TCriteria;
$unidade_id = TSession::getValue("userunitid");
$this->filter_criteria->add(new TFilter('system_unit_id', '=', $unidade_id));
@sousagarcia
sousagarcia / .php
Created June 29, 2021 12:01 — forked from scriptdev/.php
ATUALIZAÇÃO AUTOMÁTICA DOS REGISTROS DO DATAGRID APÓS x TEMPO
<?php
public function __construct($param = null)
{
parent::__construct();
// creates the form
$this->form = new BootstrapFormBuilder(self::$formName);
// define the form title
@scriptdev
scriptdev / .php
Last active April 20, 2024 00:17
ATUALIZAÇÃO AUTOMÁTICA DOS REGISTROS DO DATAGRID APÓS x TEMPO
<?php
public function __construct($param = null)
{
parent::__construct();
// creates the form
$this->form = new BootstrapFormBuilder(self::$formName);
// define the form title
@scriptdev
scriptdev / .php
Last active April 20, 2024 00:15
SIMULAR O CLIQUE NO BOTÃO VIA JAVASCRIPT
<?php
# DEFINE O ID DO BOTÃO
$button_entrar->id = 'tbutton_btn_entrar';
# jQUERY
TScript::create('$("#tbutton_btn_entrar").click();');
# JAVASCRIPT
TScript::create('document.getElementById("tbutton_btn_entrar").click();');
@lvxianchao
lvxianchao / npm.taobao.sh
Last active April 20, 2024 00:15
设置 npm 和 yarn 的镜像源为淘宝镜像源
# ==========================================================
# NPM
# ==========================================================
npm set registry https://registry.npmmirror.com # 注册模块镜像
npm set disturl https://npmmirror.com/mirrors/node # node-gyp 编译依赖的 node 源码镜像
## 以下选择添加
npm set sass_binary_site https://registry.npmmirror.com/mirrors/node-sass # node-sass 二进制包镜像
npm set electron_mirror https://registry.npmmirror.com/mirrors/electron/ # electron 二进制包镜像