Skip to content

Instantly share code, notes, and snippets.

@scriptdev
scriptdev / .php
Last active April 19, 2024 03:46
CRIAR IDENTIFICADOR ÚNICO PARA REGISTRO
<?php
$object = new Contrato();
$object->identificador = date('YmdHis').''.uniqid();
$object->store();
# EXEMPLO: 2023010511492663b6e376917bf
@scriptdev
scriptdev / .php
Last active April 19, 2024 03:45
LIMPA O AUTOCOMPLETE DOS CAMPOS NO FORMULÁRIO
<?php
public function __construct( $param )
{
parent::__construct();
# LIMPA O AUTOCOMPLETE DOS CAMPOS NO FORMULÁRIO
$campos = $this->form->getFields();
if($campos)
@Henrik-N
Henrik-N / c_defines.h
Created January 11, 2022 11:19
Defines
// C / pre-C++17
typedef unsigned char u8;
typedef unsigned short u16;
typedef unsigned int u32;
typedef unsigned long long u64;
typedef signed char i8;
typedef signed short i16;
typedef signed int i32;
@scriptdev
scriptdev / .php
Last active April 19, 2024 03:45
GERAÇÃO NFe/NFCe - API Cloud-DFE
<?php
public function onEnviarNFe($param = null)
{
try
{
TTransaction::open('banco');
$venda = Venda::find($param['key']);
@thiagozs
thiagozs / gomock.md
Last active April 19, 2024 03:45
Tutorial gomock

08/16/17 by  Sergey Grebenshchikov

No Comments

This is a quick tutorial on how to test code using the GoMock mocking library and the standard library testing package testing.

GoMock is a mock framework for Go. It enjoys a somewhat official status as part of the github.com/golang organization, integrates well with the built-in testing package, and provides a flexible expectation API.

@scriptdev
scriptdev / .php
Created January 6, 2023 02:40
IMAGEM e TEXTO COM TEMPLATE HTML NO TDBRadioGroup
<?php
# $cartao = new TDBRadioGroup('cartao', 'bd', 'Cartao', 'id', '{bandeiraCartao}','id asc' );
class Cartao extends TRecord
{
const TABLENAME = 'cartao';
const PRIMARYKEY = 'id';
const IDPOLICY = 'serial';
@bmaupin
bmaupin / free-database-hosting.md
Last active April 19, 2024 03:45
Free database hosting
@scriptdev
scriptdev / .php
Last active April 19, 2024 03:45
PEGAR O VALOR MÁXIMO DO REGISTRO
<?php
TTransaction::open(self::$database);
$serie = (int) NotaFiscal::maxBy('serie') + 1;
$nota_fiscal->serie = $serie;
TTransaction::close();
@nepsilon
nepsilon / how-to-git-patch-diff.md
Last active April 19, 2024 03:45
How to generate and apply patches with git? — First published in fullweb.io issue #33

How to generate and apply patches with git?

It sometimes happen you need change code on a machine from which you cannot push to the repo. You’re ready to copy/paste what diff outputs to your local working copy.

You think there must be a better way to proceed and you’re right. It’s a simple 2 steps process:

1. Generate the patch:

git diff &gt; some-changes.patch
@scriptdev
scriptdev / .php
Last active April 19, 2024 03:45
CLONAR REGISTRO NO DATAGRID
<?php
public function onClonarRegistro($param = null)
{
try
{
$id = (int) $param['key'];
if ($id > 0)
{