Skip to content

Instantly share code, notes, and snippets.

@scriptdev
scriptdev / .php
Last active April 19, 2024 03:31
CONVERTER IMAGEM BASE64 PARA CAMINHO + IMAGEM NO SERVIDOR
<?php
$cliente = Cliente::find(1);
$arquivo = $cliente->imagem_base64;
$caminho = 'app/output/imagem';
$explode = explode(";base64,", $arquivo);
$tipo = explode("image/", $explode[0]);
$extensao = $tipo[1];
@scriptdev
scriptdev / .php
Last active April 19, 2024 03:30
HABILITAR e DESAHABILITAR O BOTÃO
<?php
$btn_onsave = $this->form->addAction("SALVAR", new TAction([$this, 'onSave'],['static' => 1]), 'fas:save #000000');
$this->btn_onsave = $btn_onsave;
# HABILITA O BOTÃO
TButton::enableField(self::$formName, 'btn_salvar');
# DESAHABILITA O BOTÃO
@scriptdev
scriptdev / .css
Created February 28, 2023 13:16
ALTERA COR DE FUNDO DO CAMPO DESABILITADO
/*ALTERA COR DE FUNDO DO CAMPO DESABILITADO*/
.tselect_disabled, .tfield_disabled, .tcombo_disabled, .form-control:disabled, .form-control[readonly] {
background-color: #FFFFFF !important;
opacity: 1;
color: #516283 !important;
}
@kauffmanes
kauffmanes / install_anaconda.md
Last active April 19, 2024 03:30
Install Anaconda on Windows Subsystem for Linux (WSL)

Thanks everyone for commenting/contributing! I made this in college for a class and I no longer really use the technology. I encourage you all to help each other, but I probably won't be answering questions anymore.

This article is also on my blog: https://emilykauffman.com/blog/install-anaconda-on-wsl

Note: $ denotes the start of a command. Don't actually type this.

Steps to Install Anaconda on Windows Ubuntu Terminal

  1. Install WSL (Ubuntu for Windows - can be found in Windows Store). I recommend the latest version (I'm using 18.04) because there are some bugs they worked out during 14/16 (microsoft/WSL#785)
  2. Go to https://repo.continuum.io/archive to find the list of Anaconda releases
  3. Select the release you want. I have a 64-bit computer, so I chose the latest release ending in x86_64.sh. If I had a 32-bit computer, I'd select the x86.sh version. If you accidentally try to install the wrong one, you'll get a warning in the terminal. I chose `Anaconda3-5.2.0-Li
@scriptdev
scriptdev / .php
Created March 3, 2023 18:59
CARREGAR REGISTROS USANDO O MÉTODO select()
<?php
$pessoas = Pessoa::select('nome', 'cpf', 'celular', 'email')
->where('situacao', '=', 'ATIVO')
->load();
# RETORNO:
# SELECT nome, cpf, celular, email FROM pessoa WHERE situacao = 'ATIVO'
WITH price_history_per_shop_per_article AS (
SELECT
shop_id,
article_id,
ARRAY_AGG((SELECT AS STRUCT T.* EXCEPT(shop_id, article_id)) ORDER BY start_datetime) as price_history
FROM `supermarket.sell_price_history` T
GROUP BY shop_id, article_id
)
, promotion_history_per_shop_per_article AS (
SELECT
@scriptdev
scriptdev / .php
Last active April 19, 2024 03:30
SALVAR ID DO USUÁRIO LOGADO APENAS NA INCLUSÃO DO REGISTRO
<?php
public function onSave($param = null)
{
try
{
TTransaction::open(self::$database);
$messageAction = null;
@scriptdev
scriptdev / .php
Created March 6, 2023 11:39
MUDAR MÁSCARA DO CAMPO ( TEntry::changeMask )
<?php
public static function onTipoPessoa($param = null)
{
try
{
$tipo_pessoa = $param['tipo_pessoa'];
if ($tipo_pessoa == 'JURÍDICA')
{
@scriptdev
scriptdev / .php
Last active April 19, 2024 03:29
FORMATAR DATA e HORA NA CLASSE MODEL
<?php
class Tarefa extends TRecord
{
const TABLENAME = 'tarefa';
const PRIMARYKEY = 'id';
const IDPOLICY = 'serial';
public function __construct($id = NULL, $callObjectLoad = TRUE)
@scriptdev
scriptdev / .php
Last active April 19, 2024 03:29
DEFINIR ORDENAÇÃO NO CRITÉRIO DE FILTRO
<?php
$criteria = new TCriteria;
$criteria->add(new TFilter('etapa_id', '=', 1));
$criteria->setProperty('limit', 10);
$criteria->setProperty('order', 'data_atualizacao desc, ordem asc'); # DEFINE A ORDENAÇÃO DE 2 CAMPOS
$criteria->setProperty('order', 'ordem asc');
#$criteria->setProperty('direction','desc');
$negociacoes = Negociacao::getObjects($criteria);