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 / 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",
@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 {
<?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';
<?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
@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 / 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 / Digital-Ocean-Ubuntu-1210-64bit-LAMP-Server
Created September 28, 2016 14:27
Digital Ocean Ubuntu 12.10 64bit LAMP Setup
#!/bin/bash
# log into your server
ssh root@[server ipaddress]
# change root password
passwd
# update all packages and operating system
apt-get update && apt-get --yes upgrade
@robertopc
robertopc / .gitconfig
Created November 8, 2017 22:21 — forked from pksunkara/config
Sample of git config file (Example .gitconfig)
[user]
name = Pavan Kumar Sunkara
email = pavan.sss1991@gmail.com
[core]
editor = vim
whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol
excludesfile = ~/.gitignore
[sendemail]
smtpencryption = tls
smtpserver = smtp.gmail.com
@robertopc
robertopc / jekyll-new-post-advanced
Last active November 29, 2017 22:16 — forked from aamnah/jekyll-new-post-advanced
Bash script to create new Jekyll posts
#!/bin/bash
# About: Bash script to create new Jekyll posts
# Author: @AamnahAkram
# URL: https://gist.github.com/aamnah/f89fca7906f66f6f6a12
# Description: This is a more advanced version of the script which can
# - take options
# - has color coded status messages
# - improved code
# - lowercase permalinks
# - usage message
@robertopc
robertopc / gist:d083223dd324c4fd44a34f3a9ab09bb0
Created December 18, 2017 18:22 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue: