Skip to content

Instantly share code, notes, and snippets.

View robertopc's full-sized avatar

Roberto Pereira da Costa robertopc

View GitHub Profile
/**
* UTF8 TRANSLITERATION
*
* @derivate https://gist.github.com/funkjedi/4138022
*/
function utf8_transliteration($string) {
$find = {" ","¡","¢","£","¤","¥","¦","§","¨","©","ª","«","¬","­","®","¯","°","±","²","³","´","µ","¶","·","¸","¹","º","»","¼","½","¾","¿","À","Á","Â","Ã","Ä","Å","Æ","Ç","È","É","Ê","Ë","Ì","Í","Î","Ï","Ð","Ñ","Ò","Ó","Ô","Õ","Ö","×","Ø","Ù","Ú","Û","Ü","Ý","Þ","ß","à","á","â","ã","ä","å","æ","ç","è","é","ê","ë","ì","í","î","ï","ð","ñ","ò","ó","ô","õ","ö","÷","ø","ù","ú","û","ü","ý","þ","ÿ","Ā","ā","Ă","ă","Ą","ą","Ć","ć","Ĉ","ĉ","Ċ","ċ","Č","č","Ď","ď","Đ","đ","Ē","ē","Ĕ","ĕ","Ė","ė","Ę","ę","Ě","ě","Ĝ","ĝ","Ğ","ğ","Ġ","ġ","Ģ","ģ","Ĥ","ĥ","Ħ","ħ","Ĩ","ĩ","Ī","ī","Ĭ","ĭ","Į","į","İ","ı","IJ","ij","Ĵ","ĵ","Ķ","ķ","ĸ","Ĺ","ĺ","Ļ","ļ","Ľ","ľ","Ŀ","ŀ","Ł","ł","Ń","ń","Ņ","ņ","Ň","ň","ʼn","Ŋ","ŋ","Ō","ō","Ŏ","ŏ","Ő","ő","Œ","œ","Ŕ","ŕ","Ŗ","ŗ","Ř","ř","Ś","ś","Ŝ","ŝ","Ş","ş","Š","š","Ţ","ţ","Ť","ť","Ŧ","ŧ","Ũ","ũ","Ū","ū","Ŭ","ŭ","Ů","ů","Ű","ű","Ų","ų","Ŵ","ŵ","Ŷ","ŷ","Ÿ","Ź","ź","Ż","ż
@robertopc
robertopc / adminer.css
Created June 7, 2016 13:06
Adminer Blue Theme
/**
* @package Adminer.css - Theme CSS for Adminer - blue
* @version 2.1.4
* @date Sat, 24 Oct 2015 21:16:48 +0100, Slovakia
* @author Robert Mesaros
* @copyright Copyright © 2015 Robert Mesaros, rmSOFT
* @web http://www.rmsoft.sk
* @link http://www.rmsoft.sk/index.php/en/portfolio/programming-work/web-services/theme-for-adminer
*
* @donate https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=BB4D8Y28YZDH6
@robertopc
robertopc / adminer.css
Last active April 2, 2023 14:16
Adminer Black Custom Theme
/** theme "easy on the eyes" for Adminer by p.galkaev@miraidenshi-tech.jp */
/** customized by RobertoPC in https://gist.github.com/robertopc/bf2edac131bbaf789343fa9ce3ceb2e4 **/
@import url(//fonts.googleapis.com/css?family=Roboto+Mono:400,900);
/* for font awesome */
*:not(.fa) {
font-family: 'Roboto Mono', sans-serif;
}
@robertopc
robertopc / regex-validations.js
Last active August 9, 2018 01:27
Validações em Expressões Regulares no Javascript regex js
// Data e hora dd/mm/yyyy hh:mm
var data = "01/01/2000 12:00:00".match(/^(0[1-9]|[12][0-9]|3[01])\/(0[1-9]|1[0-2])\/[0-9]{4} (0[0-9]|1[0-9]|2[0-3]):([0-5][0-9])$/);
console.log(data);
// Email
var email = "email@abc.com".match(/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/);
console.log(email);
@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;
@robertopc
robertopc / bootstrap-elementary.sh
Last active November 26, 2016 13:25
Bootstrap Elementary Linux
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys BBEBDCB318AD50EC6865090613B00F1FD2C19886 &&
echo deb http://repository.spotify.com stable non-free | sudo tee /etc/apt/sources.list.d/spotify.list &&
sudo add-apt-repository -y ppa:noobslab/indicators &&
sudo add-apt-repository -y ppa:noobslab/apps &&
sudo add-apt-repository -y ppa:nilarimogard/webupd8 &&
sudo add-apt-repository -y ppa:mpstark/elementary-tweaks-daily &&
sudo add-apt-repository -y ppa:webupd8team/java &&
sudo add-apt-repository -y ppa:transmissionbt/ppa &&
sudo apt-add-repository -y ppa:umang/indicator-stickynotes &&
sudo add-apt-repository -y ppa:yannubuntu/boot-repair &&
<?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 <contato@thiagobelem.net>
* @link https://gist.github.com/3438461
*/
class Bcrypt {
@robertopc
robertopc / gmail_codeigniter.php
Last active August 29, 2015 14:27
Envio de email com Gmail no CodeIgniter
<?php
$this->load->library('email');
$this->email->initialize(array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => '465',
'smtp_timeout' => '60',
'smtp_user' => '{{{email gmail}}}',