Skip to content

Instantly share code, notes, and snippets.

View jhowbhz's full-sized avatar
:shipit:
Um programador apaixonado pelo que faz

Jonathan Henrique jhowbhz

:shipit:
Um programador apaixonado pelo que faz
View GitHub Profile
@jhowbhz
jhowbhz / pagina.php
Last active May 30, 2023 15:00
Exemplo F7/JSON/PHP
<?php
header('Access-Control-Allow-Origin: *'); // no cabeçalho
$array = array ('test1', 'test2', 'test3');
echo json_encode ($ array);
?>
@jhowbhz
jhowbhz / script.js
Last active May 30, 2023 15:00
exampe F7/JSON/PHP
var test1 = 'test1';
var test2 = 'test2';
app.request.get ('pagina.php', {
FIELD1: teste1,
FIELD2: test2,
}, function (data) {
JSON.parse (data) // transforms into JSON array
console.log (data); // prints on the console the return
})
@jhowbhz
jhowbhz / example_ajax.html
Last active May 30, 2023 15:00
example_ajax
<!DOCTYPE html>
<html>
<title> TESTE AJAX </title>
<body>
<button>CLIQUE AQUI</button>
<div id="teste"> </div>
</body>
</html>
<!DOCTYPE html>
<html>
<title> TESTE AJAX </title>
<body>
<button onclick="nome_da_funcao()">CLIQUE AQUI</button>
<div id="teste"> </div>
</body>
</html>
@jhowbhz
jhowbhz / Install_php_7.2.shell
Created June 21, 2018 16:04
Como instalar PHP 7.2 Ubuntu 16
apt-get update && apt-get upgrade
apt-get install python-software-properties
add-apt-repository ppa:ondrej/php
apt-get update
apt-get install php7.2
apt-get install php-pear php7.2-curl php7.2-dev php7.2-gd php7.2-mbstring php7.2-zip php7.2-mysql php7.2-xml
@jhowbhz
jhowbhz / installLetsEncrypt.sh
Created June 21, 2018 17:12
Como instalar Let's Encrypt seguro ubuntu 16
# bin bash!
sudo add-apt-repository ppa:certbot/certbot
sudo apt-get update
sudo apt-get install python-certbot-apache
sudo certbot --apache -d example.com
sudo certbot --apache -d example.com -d www.example.com
sudo certbot renew --dry-run
@jhowbhz
jhowbhz / Laravel_Detalhes.txt
Last active January 17, 2019 18:29
Detalhes de como instalar o LARAVEL ubuntu 16
# EXTENSÕES PHP
sudo apt install php7.2 libapache2-mod-php7.2 php7.2-mbstring php7.2-xmlrpc php7.2-soap php7.2-gd php7.2-xml php7.2-cli php7.2-zip
# INSTALANDO O COMPOSER UBUNTU 16+
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
#PERMISSÕES PASTA PROJETO
sudo chown -R www-data:www-data /var/www/html/MyProject/
sudo chmod -R 755 /var/www/html/MyProject/
@jhowbhz
jhowbhz / backup.js
Created June 22, 2018 19:53 — forked from CesarBalzer/backup.js
Script backup sqllite cordova com o plugin sqlporter e arquivo txt na raiz do dispositivo
/**
*
* @var db Base de dados para backup e restauracao
*/
var db = window.openDatabase("CAMINHO DO BANCO", "1.0", "NOME DO BANCO", 5 * 2048);
/**
* Mostra o erro de arquivo
* @param {obj} error Recebe o objeto de erro
* @returns {void}
*/
@jhowbhz
jhowbhz / laravel_types_columns.txt
Last active August 9, 2021 18:44
Tipos de colunas aceitas pelo Eloquent Laravel 5.5
TIPOS DE CAMPOS SUPORTADOS
-------------------------------
$table->bigIncrements('id'); Auto-incrementing UNSIGNED BIGINT (primary key) equivalent column.
$table->bigInteger('votes'); BIGINT equivalent column.
$table->binary('data'); BLOB equivalent column.
$table->boolean('confirmed'); BOOLEAN equivalent column.
$table->char('name', 100); CHAR equivalent column with an optional length.
$table->date('created_at'); DATE equivalent column.
$table->dateTime('created_at'); DATETIME equivalent column.
@jhowbhz
jhowbhz / AppServiceProvider.php
Created June 28, 2018 17:27
SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes
// Corrigindo o problema relacionado ao chasert do banco
// Setar 191max
public function boot(){
Schema::defaultStringLength(191);
}