Skip to content

Instantly share code, notes, and snippets.

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

Jhon jhowbhz

🦾
Um programador apaixonado pelo que faz
View GitHub Profile
@jhowbhz
jhowbhz / captalize_function.php
Created July 2, 2018 14:55
Correção de nomes
<?php
function capitalize($string, $encoding = 'UTF-8')
{
$word_splitters = [' ', '-', "O’", "L’", "D’", 'St.', 'Mc', "Dall'", "l’", "d’", "a’", "o’"];
$lowercase_exceptions = ['the', 'van', 'den', 'von', 'und', 'der', 'da', 'of', 'and', "d’",
'das', 'do', 'dos', 'e', 'el'];
$uppercase_exceptions = ['III', 'IV', 'VI', 'VII', 'VIII', 'IX', 'ME', 'EIRELI', 'EPP', 'S/A', 'S.A', 'LTDA'];
$string = mb_strtolower($string, $encoding);
$string = str_replace("'", "’", $string);
foreach ($word_splitters as $delimiter)
@jhowbhz
jhowbhz / UsersTableSeeder.php
Last active August 10, 2019 03:50
exemplo de um seed laravel
<?php
/*
/ in command line: php artisan make:seed UsersTableSeeder;
*/
use Illuminate\Database\Seeder;
use App\User;
class UsersTableSeeder extends Seeder
@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);
}
@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 / 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_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 / 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 / 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
<!DOCTYPE html>
<html>
<title> TESTE AJAX </title>
<body>
<button onclick="nome_da_funcao()">CLIQUE AQUI</button>
<div id="teste"> </div>
</body>
</html>
@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>