Linux installation notes (tested under Ubuntu 12.04LTS), assuming VirtualBox is already installed on host.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function git_branch_name() { | |
git branch 2>/dev/null | grep -e '^*' | sed -E 's/^\* (.+)$/(\1) /' | |
} | |
function show_colored_git_branch_in_prompt() { | |
PS1="\[\033[01;32m\]\u@\h:\[\033[01;34m\]\w\[\033[31m\]\$(git_branch_name)\[\033[m\]$ " | |
} | |
show_colored_git_branch_in_prompt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
# apaga tmp | |
find /tmp/ -type f -print -delete | |
# apaga logs compactados | |
find /var/log/ -type f -iname *.gz -print -delete | |
# zera conteudo dos logs | |
find /var/log/ -type f -print -exec truncate -s 0 {} \; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PS1='\[\033[0;37m\][\t]\[\033[0;32m\][\u]\[\033[31m\][\h]`git branch 2>/dev/null | grep \* | head -1 | sed "s/\* //g" | awk "{ print \"[ \"\\\$1 \" ]\" }"` \[\033[1;33m\]\w\a\[\033[0m\]\n\$ ' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace My\Custom\Doctrine2\Function; | |
/** | |
* RandFunction ::= "RAND" "(" ")" | |
*/ | |
class Rand extends FunctionNode | |
{ | |
public function parse(\Doctrine\ORM\Query\Parser $parser) |
Ao invés de fazer uma querie enorme com CASE-THEN-ELSE, usar a função COALESCE. Ela retorna o primeiro argumento NOT NULL.
Isso:
SELECT CASE WHEN evento.realizado_em IS NULL THEN '' ELSE evento.realizado_em END FROM TableA
Vira isso:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class LayoutExtension extends \Twig_Extension | |
{ | |
/** | |
* {@inheritdoc} | |
*/ | |
public function getName() | |
{ | |
return 'yolo'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Symfony\Component\HttpKernel\Kernel; | |
use Symfony\Component\Config\Loader\LoaderInterface; | |
class AppKernel extends Kernel | |
{ | |
// .... | |
protected function getKernelParameters() |
How is listed with vagrant plugin list |
How to use in Vagrant.has_plugin? | link to plugin.rb in repo |
---|---|---|
bindler | Bindler | fgrehm/bindler |
vagrant-hostmanager | HostManager | smdahlen/vagrant-hostmanager |
vagrant-cachier | vagrant-cachier | fgrehm/vagrant-cachier |
vagrant-aws | AWS | mitchellh/vagrant-aws |
vagrant-rackspace | RackSpace Cloud | mitchellh/vagrant-rackspace |
vagra |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Esse snippet é uma resposta para dúvida a seguir. Pode ser melhorado | |
* de diversas formas (fazendo uso de recursão, por exemplo), mas o intuito é ser simples. | |
* | |
* Alguém ai on pra me da uma ajudinha com PHP? | |
* Tipo, em vários lugar da internet é possível visualizar formatações de números | |
* como "150k", "1kk", alguns devem saber que 150k corresponde a 150.000 e 1kk | |
* corresponder a 1.000.000... Gostaria então de saber como se faz isso na hora | |
* do "echo"! |