Skip to content

Instantly share code, notes, and snippets.

@juizmill
juizmill / gist:11391809
Last active August 29, 2015 14:00
Regex formato de telefone 8 ou 9 números
^\(((\d{2})|(\d{3}))\)\s(\d{5}|\d{4})-\d{4}$
Exemplos:
(99) 9999-9999
ou
(99) 99999-9999
ou
(999) 9999-9999
ou
(999) 99999-9999
@juizmill
juizmill / gist:11392019
Created April 29, 2014 06:24
Regex formato de CPF simples
^(\d{3}[.]){2}\d{3}[-]\d{2}$
Exemplo:
999.999.999-99
<?php
namespace Application\Entity\Repository;
use Application\Entity\Usuario;
use Doctrine\ORM\EntityRepository;
class UsuarioRepository extends EntityRepository
{
public function findByLoginAndPassword(Usuario $usuario, $login, $password)
<?php
public function completeVideoVimeo(Array $data)
{
try{
$check = $this->vimeo->call('vimeo.videos.upload.checkTicket', array(
'oauth_token' => $this->config['vimeo']['token'],
'ticket_id' => $data['ticket']));
$complete = $this->vimeo->call('vimeo.videos.upload.complete', array(
@juizmill
juizmill / gist:317948c886360100a7cf
Created June 28, 2014 20:15
bootstrap.sh - Vagrant
#!/usr/bin/env bash
#Variáveis de configuração do projeto
ProjectName="cms"
PathPublic="public"
sudo apt-get update
sudo apt-get install -y python-software-properties
#Pacote PHP 5.5 ou 5.4
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "hashicorp/precise64"
config.vm.provision :shell, :path => "bootstrap.sh"
config.vm.network :forwarded_port, host: 8080, guest: 80
function git_branch_name() {
git branch 2>/dev/null | grep -e '^*' | sed -E 's/^\* (.+)$/(\1) /'
}
function show_colored_git_branch_in_prompt() {
PS1="\[\033[38m\]\h:\[\033[032m\]\W\[\033[31m\]\$(git_branch_name)\[\033[m\]$ "
}
show_colored_git_branch_in_prompt
@juizmill
juizmill / ZF2 composer.json
Created December 2, 2014 11:26
ZF2 composer.json
{
"name": "zendframework/skeleton-application",
"description": "Luciano Bezerra",
"license": "BSD-3-Clause",
"keywords": [
"framework",
"zf2"
],
"homepage": "http://framework.zend.com/",
"require": {
@juizmill
juizmill / config.php
Last active August 29, 2015 14:11
Arquivo config.php
<?php
//Get Route
function getRoute()
{
$current_path = parse_url('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
return array_filter(explode('/',$current_path['path']));
}
//Fetch page content
function fetchContent()
{
@juizmill
juizmill / gist:96a0da9634b0a1bbcf51
Created December 12, 2014 19:48
Arquivo index.php
<?php require_once('config/config.php');?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="../../favicon.ico">