Skip to content

Instantly share code, notes, and snippets.

View robertopc's full-sized avatar

Roberto Pereira da Costa robertopc

View GitHub Profile
@robertopc
robertopc / ubuntu-server-setup-16.04-LAMP.md
Last active March 6, 2018 19:00 — forked from Otienoh/ubuntu-server-setup-16.04-LAMP.md
LAMP Server setup for Ubuntu 16.04 on Digital Ocean

Server setup for Ubuntu 16.04 on Digital Ocean

The setup installs the following software:

The setup installs the following software:

  • Apache
  • MySQL
  • PHP
  • Node
@robertopc
robertopc / gist:e231866361fae2148934
Last active August 9, 2018 01:28 — forked from guisehn/gist:3276015
Validar CPF (PHP)
<?php
function validar_cpf($cpf)
{
$cpf = preg_replace('/\D/', '', (string) $cpf);
// Valida tamanho
if (strlen($cpf) != 11)
return false;
<?php
// Inclui o arquivo class.phpmailer.php localizado na pasta phpmailer
require_once("phpmailer/class.phpmailer.php");
// Inicia a classe PHPMailer
$mail = new PHPMailer();
// Define os dados do servidor e tipo de conexão
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
$mail->IsSMTP(); // Define que a mensagem será SMTP
<?php
// Encriptando a senha
$senha = 'ola mundo';
$hash = Bcrypt::hash($senha);
// $hash = $2a$08$MTgxNjQxOTEzMTUwMzY2OOc15r9yENLiaQqel/8A82XLdj.OwIHQm
// Salve $hash no banco de dados
// Verificando a senha
$senha = 'ola mundo';
@robertopc
robertopc / Bcrypt.php
Last active August 29, 2015 14:27 — forked from TiuTalk/Bcrypt.php
<?php
/**
* Bcrypt hashing class
*
* @author Thiago Belem <[email protected]>
* @link https://gist.github.com/3438461
*/
class Bcrypt {
@robertopc
robertopc / utf8_transliteration.php
Last active August 29, 2015 14:27 — forked from funkjedi/gist:4138022
Converte caracteres especiais em caracteres simples(ASCII). Exemplo: ç > c, á > a, Á > A, etc...
<?php
/*
Converte caracteres especiais em caracteres simples(ASCII).
Exemplos: ç > c, á > a, Á > A, etc...
*/
function utf8_translit($string) {
$characters = array(
" " /* 00a0 'NO-BREAK SPACE' */ => " ",
"¡" /* 00a1 'INVERTED EXCLAMATION MARK' */ => "!",
"¢" /* 00a2 'CENT SIGN' */ => "c",