Skip to content

Instantly share code, notes, and snippets.

View cortezfelipe's full-sized avatar

Felipe Cortez cortezfelipe

View GitHub Profile
https://stackoverflow.com/questions/39824219/install-php-5-3-or-5-4-on-ubuntu-16-04-xenial-and-apache
https://everton.rocks/conteudo/multiple-php-versions-apache
sudo a2dismod php5.6 && sudo a2enmod php7.2 && sudo service apache2 restart
https://github.com/peachpiecompiler/peachpie/
http://gabsferreira.com/instalando-e-usando-o-net-core-no-linux/
https://docs.peachpie.io/
$valid_passwords = array ("mario" => "carbonell");
$valid_users = array_keys($valid_passwords);
$user = $_SERVER['PHP_AUTH_USER'];
$pass = $_SERVER['PHP_AUTH_PW'];
$validated = (in_array($user, $valid_users)) && ($pass == $valid_passwords[$user]);
if (!$validated) {
header('WWW-Authenticate: Basic realm="My Realm"');
@cortezfelipe
cortezfelipe / Custom.js
Last active April 3, 2020 12:25
Personalizar datas Adianti
$campodata->setOption('triggerEvent', 'dblclick');
//alterar as configurações da data thema4
function tdate_start( id, mask, language, size, options) {
$( id ).wrap( '<div class="tdate-group date">' );
$( id ).after( '<span class="btn btn-default tdate-group-addon"><i class="glyphicon glyphicon-calendar"></i></span>' );
$( id ).bootstrapMaterialDatePicker({
lang: language,
@cortezfelipe
cortezfelipe / Form.php
Created February 25, 2020 16:14
Eventos em formulários
//Validação no cliente
$this->form->setClientValidation(true); //habilita validação no navegador
$nome->setProperty('oninvalid',"this.setCustomValidity('Preencha o campo')");
$nome->setProperty('oninput',"setCustomValidity('')");
//postar dados sem sair da página
TApplication::postData('form_', 'Class_', 'onReload');
//executar função após salvar com refresh
$this->setAfterSaveAction( new TAction([$this, 'onClose']));
@cortezfelipe
cortezfelipe / ConexaoPrepare.php
Created February 25, 2020 16:06
Exemplo conexão com prepare
<?php
class ConexaoPrepare extends TPage
{
public function __construct()
{
parent::__construct();
try
{
TTransaction::open('curso');
@cortezfelipe
cortezfelipe / download.php
Created February 25, 2020 16:03
Rotina para baixar arquivos pela extensão.
<?php
if (isset($_GET['file']))
{
$file = $_GET['file'];
$info = pathinfo($file);
$extension = $info['extension'];
$content_type_list = array();
$content_type_list['txt'] = 'text/plain';
$content_type_list['html'] = 'text/html';
@cortezfelipe
cortezfelipe / FormDBAutoSelectionView.php
Created February 25, 2020 15:44
Abrir Select ao selecionar outra Select ou Combo
<?php
/**
* <?php
/**
* FormDBAutoSelectionView
*
* @version 1.0
* @package samples
* @subpackage tutor
* @author Pablo Dall'Oglio