Skip to content

Instantly share code, notes, and snippets.

View guilhermewop's full-sized avatar
😎
Coders gonna code

Guilherme Pereira guilhermewop

😎
Coders gonna code
View GitHub Profile
@guilhermewop
guilhermewop / vagrant-centos.md
Created February 7, 2014 15:03
CentOS Vagrant

Vagrant de desenvolvimento CentOS 6.3 LAMP

vagrant box add centos-6.3 https://s3.amazonaws.com/itmat-public/centos-6.3-chef-10.14.2.box
mkdir vagrant-lamp
vagrant init centos-6.3
@guilhermewop
guilhermewop / zf2_restrict_login.php
Last active August 29, 2015 13:57
Zend Framework 2. Restringe o acesso às páginas fora da white list. Útil para controlar login. Use no Module::onBootstrap
<?php
/**
* Restringe o acesso às páginas fora da white list. útil para controlar login.
*
* @param Zend\Mvc\MvcEvent $e Instância
* @param Mixed $authService Instância do serviço de autenticação
* @param Array $whiteListRoutes Lista de rotas na white list (Sem precisar de login)
* @param String $loginRoute Nome da rota para o login
* @link http://stackoverflow.com/questions/14137868/zend-framework-2-global-check-for-authentication-with-zfcuser
@guilhermewop
guilhermewop / .htaccess
Created December 22, 2014 18:02
Zend Framework 2 htaccess
RewriteEngine On
# The following rule tells Apache that if the requested filename
# exists, simply serve it.
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
# The following rewrites all other queries to index.php. The
# condition ensures that if you are using Apache aliases to do
# mass virtual hosting, the base path will be prepended to
@guilhermewop
guilhermewop / zf2-vhost.conf
Last active August 29, 2015 14:13
Zend Framework 2 Apache virtual host
<VirtualHost *:80>
ServerName application.local
DocumentRoot <application-path>/public
SetEnv APPLICATION_ENV development
<Directory <application-path>/public>
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
@guilhermewop
guilhermewop / apigility-client-example.php
Last active August 29, 2015 14:22
Apigility client usage
<?php
namespace Application\Controller;
use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel;
class IndexController extends AbstractActionController
{
public function indexAction()
{
-----------------------------------------
Novos branches
-----------------------------------------
1 - Criar branch
1.1 - Atualizar repositório do trunk
svn up
1.2 - Fazer cópia do trunk para a pasta dos branches
svn cp http://svn.fcl.com.br/svn/<nome-do-projeto>/trunk http://svn.fcl.com.br/svn/<nome-do-projeto>/branches/<nome-do-branch> -m "Comentário..."
@guilhermewop
guilhermewop / 42.js
Created September 12, 2012 21:34
Resposta para a vida o universo e tudo mais
/* A resposta para a vida o universo e tudo mais = 42. Douglas Adams (Guia do mochileiro das galáxias)
*
* Google: https://www.google.com/webhp?sourceid=chrome-instant&ie=UTF-8&ion=1#hl=pt-BR&safe=off&sclient=psy- ab&q=resposta%20para%20a%20vida%20o%20universo%20e%20tudo%20mais&oq=&gs_l=&pbx=1&fp=e8f2ebbc99d26e1a&ion=1&bav=on.2,or.r_gc.r_pw.r_cp.r_qf.&biw=1920&bih=915
*
* What the fuck Javascript: http://wtfjs.com/2011/11/11/the-universe-answers-and-JavaScript-still-makes-us-wtf
*/
var resposta = "3" -+-+-+ "1" + "1" / "3" * "6" + "2";
alert(resposta);
@guilhermewop
guilhermewop / .zshrc
Created September 28, 2012 19:02
My .zshrc
# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
# export ZSH_THEME="random"
export ZSH_THEME="prose"
@guilhermewop
guilhermewop / prose.zsh-theme
Last active October 11, 2015 04:17 — forked from gurgeh/gist:3800072
Theme for zsh
# Theme based on:
# http://stevelosh.com/blog/2010/02/my-extravagant-zsh-prompt/
# http://fendrich.se/blog/2012/09/28/no/
function prompt_char {
git branch >/dev/null 2>/dev/null && echo '±' && return
hg root >/dev/null 2>/dev/null && echo '☿' && return
echo '%(!.!.➜)'
}
@guilhermewop
guilhermewop / gist:3822991
Created October 2, 2012 20:09
Lamp stack+
# apache - mysql - mongo - redis - php5 - ruby + python + postgresql + gearman + memcache
# Refs:
# https://help.ubuntu.com/community/ApacheMySQLPHP
# https://docs.google.com/document/d/1m4xb0lmgxzmi4OnLPZp5A7Thab-xL-_SfZi1bq7c18Q/edit
# :: Apache ::
# :: PHP ::