Skip to content

Instantly share code, notes, and snippets.

View jotapepinheiro's full-sized avatar
🏠
Working from home

João Paulo Pinheiro jotapepinheiro

🏠
Working from home
View GitHub Profile
@jotapepinheiro
jotapepinheiro / vst-install.sh
Created December 7, 2017 02:11
Install VestaCP on Ubuntu 16.04
#!/bin/bash
# Vesta Ubuntu installer v.05
# Modified by David B (KernelPanic89) to work for Ubuntu
# Revision 1.0 - Sep 06 2016
#----------------------------------------------------------#
# Variables&Functions #
#----------------------------------------------------------#
@h@export PATH=$PATH:/sbin
@jotapepinheiro
jotapepinheiro / wp-remoto.php
Created October 29, 2016 06:34
Get Remote Data Wordpress
<?php
header("Content-type: application/json; charset=utf-8");
$http_origin = $_SERVER['HTTP_ORIGIN'];
$allowed_http_origins = array(
"http://site1.com.br",
"http://site2.com.br",
"http://site3.com.br"
);
if (in_array($http_origin, $allowed_http_origins)){
@jotapepinheiro
jotapepinheiro / dominio.php
Last active June 22, 2017 03:45
Verifica Domínio Disponivel
<?php
function geraLetras($length) {
global $abc;
settype($abc, "string");
$abc = "abcdefghijklmnopqrstuvwxyz";
settype($length, "integer");
@jotapepinheiro
jotapepinheiro / moeda.php
Created August 28, 2016 23:59
Formata Moeda PHP
<?php
$preco=Convert('USD', 'BRL','1,00');
if($preco!=false){
echo $preco;
}
else{echo "conversão não possível";}
function Convert($from, $to, $preco)
{
$url = "http://www.google.com/finance/converter?a=$preco&from=$from&to=$to";
@jotapepinheiro
jotapepinheiro / mask.php
Created August 28, 2016 23:58
Mascaras PHP
<?php
function mask($val, $mask)
{
$maskared = '';
$k = 0;
for($i = 0; $i<=strlen($mask)-1; $i++)
{
if($mask[$i] == '#')
{
if(isset($val[$k]))
@jotapepinheiro
jotapepinheiro / index.php
Created August 28, 2016 23:51
Validações PHP
<?php
include("Validator.php");
$email = "asasasas@outlook.com";
if(Validator::EmailReal($email)){
echo "The email is valid";
}else{
echo "That’s an invalid email";
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
authorize: C:\Users\JoaoPinheiro\.ssh\id_rsa.pub
keys:
- C:\Users\JoaoPinheiro\.ssh\id_rsa
@jotapepinheiro
jotapepinheiro / vagrant_share.txt
Last active July 5, 2016 20:55
Vagrant Share
--- CRIAR CONTA
https://atlas.hashicorp.com/account/new
--- FAZER LOGIN NO VAGRANT CLOUD
vagrant login
--- COMPARTILHAR PROJETO
vagrant share --http 80 --name nomeprojeto
--- VERIFICAR NOME
@jotapepinheiro
jotapepinheiro / PageTab
Last active June 9, 2016 02:18
Autenticação PageTab Facebook
http://www.facebook.com/dialog/pagetab?app_id=1420847307942373&next=https://caminhoseguro.com.br/pagina
GET TOKEN
https://developers.facebook.com/tools/explorer/
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/3.9/src/wp-includes/query.php
*/
$args = array(