Skip to content

Instantly share code, notes, and snippets.

@scriptdev
scriptdev / .php
Created May 19, 2023 13:21
ADICIONAR INTERVALO DE 20 MINUTOS ( AGENDA )
<?php
$data_final = new DateTime($data->data_inicial);
$data_final->add(new DateInterval('PT20M'));
$data->$data_final = $data_final->format('Y-m-d H:i:s');
@scriptdev
scriptdev / .php
Created May 19, 2023 16:44
ALTERAR COR DO BOTÃO
<?php
TScript::create('
$("#btn_salvar").css({
"background-color": "#00304A",
"color": "#FFFFFF"
});
');
@scriptdev
scriptdev / .php
Last active April 19, 2024 03:12
DESABILITAR CAMPO ( TDBUniqueSearch e TDBCombo )
<?php
$this->form->getField('cidade_id')->setEditable(false);
TDBUniqueSearch::disableField(self::$formName, 'cidade_id');
# AGRADECIMENTO: JOYCE
@ericmjl
ericmjl / ds-project-organization.md
Last active April 19, 2024 03:12
How to organize your Python data science project

UPDATE: I have baked the ideas in this file inside a Python CLI tool called pyds-cli. Please find it here: https://github.com/ericmjl/pyds-cli

How to organize your Python data science project

Having done a number of data projects over the years, and having seen a number of them up on GitHub, I've come to see that there's a wide range in terms of how "readable" a project is. I'd like to share some practices that I have come to adopt in my projects, which I hope will bring some organization to your projects.

Disclaimer: I'm hoping nobody takes this to be "the definitive guide" to organizing a data project; rather, I hope you, the reader, find useful tips that you can adapt to your own projects.

Disclaimer 2: What I’m writing below is primarily geared towards Python language users. Some ideas may be transferable to other languages; others may not be so. Please feel free to remix whatever you see here!

@scriptdev
scriptdev / .php
Last active April 19, 2024 03:12
DEFINIR TEMPO LIMITE DE EXECUÇÃO NO PHP ( TIMEOUT )
<?php
ini_set('max_execution_time', 0); # ILIMITADO
ini_set('max_execution_time', 300); # 5 MINUTOS
set_time_limit(0); # ILIMITADO
set_time_limit(0); # 5 MINUTOS
@scriptdev
scriptdev / .php
Created May 24, 2023 01:25
MOSTRAR TOTAL DE REGISTROS NO RODAPÉ DO FILTRO DA LISTAGEM
<?php
public function onReload($param = NULL)
{
$total_registros = (int) $repository->count();
$html_registros = "<p style='font-size:16px ;display: inline-flex !important; padding-left: 15px !important'><strong>{$total_registros} </strong> &nbsp;Total de Registros</p>";
$this->form->addFooterWidget($html_registros);
}
@scriptdev
scriptdev / .html
Last active April 19, 2024 03:11
ADICIONAR IMAGEM NO CENTRO DA PÁGINA INICIAL ( WelcomeView )
<!-- EDITE O ARQUIVO app/resources/system_welcome_pt.html -->
<!--[main]-->
<style>
.imagem {
position: absolute;
margin : auto;
height : 200px;
@scriptdev
scriptdev / .php
Last active April 19, 2024 03:10
SALVAR VALOR NO localStorage DO NAVEGADOR
<?php
# 1 - SALVA O VALOR NO localStorage
$nome = 'Fabricio';
TScript::create("localStorage.setItem('nome', '{$nome}')");
# 2 - PEGA O VALOR E ENVIAR PARA O CAMPO OCULTO "THidden" DO FORMULÁRIO
TScript::create("
var nome = localStorage.getItem('nome');
if (nome != 'undefined') {document.getElementById('nome').value = nome; }
@scriptdev
scriptdev / .txt
Created May 31, 2023 03:07
Pieces for Developers ( SALVAR SNIPPETS )
Pieces for Developers
https://pieces.app/
EXTENSÃO VSCODE:
https://marketplace.visualstudio.com/items?itemName=MeshIntelligentTechnologiesInc.pieces-vscode
SALVAR SNIPPET: SHIFT + CTRL + V
BUSCAR SNIPPET: CTRL + K
@leahcim
leahcim / 25_pre-os-prober
Created March 3, 2014 19:13
In Ubuntu, /etc/grub.d/30_os-prober overrides grub menu style and timeout defined by the user in /etc/default/grub. Here is a workaround to save the menu style and timeout values before os-prober changes them, and to restore them afterwards. The two files need to be placed under /etc/grub.d and made executable. Finally, "sudo update-grub" should…
#! /bin/sh
set -e
# Save the $timeout and $timeout_style values set by /etc/grub.d/00_header
# before /etc/grub.d/30_os-prober messes them up.
cat << EOF
set timeout_bak=\${timeout}
set timeout_style_bak=\${timeout_style}
EOF