Skip to content

Instantly share code, notes, and snippets.

@scriptdev
scriptdev / .php
Last active April 19, 2024 03:38
CLASSE PARA IMPORTAÇÃO DE XML NFe
<?php
# EXEMPLO DE USO:
$xml = new ImportarXMLNotaFiscal($arquivo_xml);
$dest = $xml->getIde();
$emit = $xml->getEmitente();
class ImportarXMLNotaFiscal
{
@brunoconstantino
brunoconstantino / .php
Created September 12, 2022 03:54
Tela para selecionar colunas em listagem
<?php
// Bruno Constantino 12-09-2022
/*
Crie uma Nova Ação no Cabeçalho;
Defina o nome da variável como "btnShowColumns";
Defina a Variável com escopo a nivel de classe como SIM;
Defina como método estático;
Defina o método como "onShowColumnsFilters";
Copie os trechos de código abaixo em seus respectivos locais definidos no Adianti Builder;
@scriptdev
scriptdev / .php
Last active January 7, 2023 09:19
MÁSCARA DINÂMICA AO DIGITAR DO TELEFONE e CELULAR NO TEntry
<?php
## ADICIONAR ANTES DO parent::add($container);##########################
TScript::create(
"$(document).on('keydown', 'input[name=\'celular\']', function (e) {
var digit = e.key.replace(/\D/g, '');
var value = $(this).val().replace(/\D/g, '');
var size = value.concat(digit).length;
$(this).mask((size <= 10) ? '(00) 0000-0000' : '(00) 00000-0000');
version: '3.7'
# Networks
networks:
# Internal network
internal:
driver: bridge
# Volumes
volumes:
@renatofrota
renatofrota / Navegacao.php
Last active December 15, 2023 20:20
Classe de Navegação para Adianti Framework
<?php
/**
* Classe de Navegação para Adianti Framework
*
* Guarda e recupera parametros relacionados (order, offset, limit, direction, page, first_page)
* para manter o estado da paginação dos datagrids ao navegar pelas classes e janelas do sistema
*
* @author Renato Frota <renatofrota@gmail.com>
*/
@gridphp
gridphp / wp-demo-snippet-latest.php
Last active February 14, 2024 00:47
Wordpress Grid 4 PHP Framework Integration - Sample Snippet tested with Wordpress 6.4.3, https://www.gridphp.com
/**
* Grid 4 PHP Framework
*
* @author Abu Ghufran <gridphp@gmail.com> - https://www.gridphp.com
* @version 2
* @date 20-Oct-2020
* @license: see license.txt included in package
*/
/*
DROP FUNCTION IF EXISTS proper;
SET GLOBAL log_bin_trust_function_creators=TRUE;
DELIMITER |
CREATE FUNCTION proper( str VARCHAR(128) )
RETURNS VARCHAR(128)
BEGIN
DECLARE c CHAR(1);
DECLARE s VARCHAR(128);
DECLARE i INT DEFAULT 1;
DECLARE bool INT DEFAULT 1;
@bougui505
bougui505 / autogit.sh
Last active February 20, 2023 16:56
#!/usr/bin/env zsh
# -*- coding: UTF8 -*-
# Author: Guillaume Bouvier -- guillaume.bouvier@pasteur.fr
# https://research.pasteur.fr/en/member/guillaume-bouvier/
# 2017-08-25 14:59:30 (UTC+0200)
usage ()
{
echo "Usage"
@jgdoncel
jgdoncel / fn_remove_accents.sql
Last active April 19, 2024 12:20
MySQL Function to remove accents and special characters
DROP FUNCTION IF EXISTS fn_remove_accents;
DELIMITER |
CREATE FUNCTION fn_remove_accents( textvalue VARCHAR(10000) ) RETURNS VARCHAR(10000)
BEGIN
SET @textvalue = textvalue COLLATE utf8_general_ci;;
-- ACCENTS
SET @withaccents = 'ŠšŽžÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝŸÞàáâãäåæçèéêëìíîïñòóôõöøùúûüýÿþƒ';
@salipro4ever
salipro4ever / PHP Clean String of UTF8 Chars – Convert to similar ASCII char
Created November 6, 2014 03:44
PHP Clean String of UTF8 Chars – Convert to similar ASCII char
/**
* Returns an string clean of UTF8 characters. It will convert them to a similar ASCII character
* www.unexpectedit.com
*/
function cleanString($text) {
// 1) convert á ô => a o
$text = preg_replace("/[áàâãªä]/u","a",$text);
$text = preg_replace("/[ÁÀÂÃÄ]/u","A",$text);
$text = preg_replace("/[ÍÌÎÏ]/u","I",$text);
$text = preg_replace("/[íìîï]/u","i",$text);