Skip to content

Instantly share code, notes, and snippets.

View andersonfraga's full-sized avatar
🧩
Focusing

Anderson Fraga andersonfraga

🧩
Focusing
View GitHub Profile
@andersonfraga
andersonfraga / checkout.sh
Created October 3, 2013 15:31
New branch and deploy! \m/
if [ $# -eq 0 ]
then
echo "C'mmon! Specific new branch, please!"
else
echo "~ git pull composer"
git pull composer
echo "~ git pull origin"
git pull origin
@andersonfraga
andersonfraga / gist:6231913
Last active December 21, 2015 01:59
Parser
<?php
$txt = array(
'08 11',
'08110054 00432 0000 15 27 4597 00 065001017',
'08110629 00017 0000 I 4597 1528 00 4597',
'08110641 00015 0000 J 4597 4595 00 4597',
'08110643 00005 0000 J 4595 4597 00 4595',
'08110647 00008 0000 J 4595 4597 00 4595',
'08110713 01058 0000 I 4597 1528 00 4597',
<?php
class Teste {
public $outro;
function __construct($outraclasse) {
$this->outro = $outraclasse;
}
}
class Loader {
@andersonfraga
andersonfraga / gist:5716387
Last active December 18, 2015 03:09
Usando o Respect/Validation para validação.. Tem maneira mais simples de recuperar as falhas na validação?
<?php
namespace Site\Controller;
use Respect\Validation\Validator as v;
class FormController extends BaseController
{
public function faleAction()
@andersonfraga
andersonfraga / gist:5204725
Created March 20, 2013 13:43
install_apache_php
apt-get -y -q install make g++ flex bison build-essential zlib1g-dev binutils \
cmake automake autoconf libmcrypt-dev libmhash-dev libxslt1-dev \
libtidy-dev libbz2-dev libxml2-dev libssl-dev curl vim git perl \
libpng12-dev libpng12-0 libpng3 libjpeg62 libjpeg62-dev libxpm-dev libpcre3 \
libpcre3-dev zlib1g zlib1g-dev libltdl-dev libltdl7 pkg-config \
libcurl4-openssl-dev libfreetype6 libfreetype6-dev libc-client2007e \
libc-client2007e-dev libkrb5-3 libkrb5-dev openssl \
libcurl4-openssl-dev libicu-dev libpspell-dev curl-dev \
linux-libc-dev libc-dev-bin libc-bin libc-client2007e-dev eglibc-source \
libkrb5-3 libkrb5-dev libkrb53 libkrb5support0 libncurses5-dev libncurses5 \
@andersonfraga
andersonfraga / uksort_fault.php
Created February 8, 2013 16:36
Segmentation fault using PHP 5.3.6 :/
<?php
$list = array(
array(
'idCliente' => 12,
),
array(
'idCliente' => 2,
),
array(
@andersonfraga
andersonfraga / gist:4117950
Created November 20, 2012 13:31
Devaneios. Microframework baseado no Zend2
<?php
use Picoznd/Session;
use Picoznd/Http/Request;
use Picoznd/Http/Response;
use Picoznd/Http/Response/CacheControl;
use Picoznd/IoC/Inject/Bag as InjectBag;
use Picoznd/Http/Request/Params as ParamsBag;
class Index
<snippet>
<content><![CDATA[${1:namespace ${2:Bar\Foo};
}
class ${3:ClassName}${4: extends ${5:AnotherClass}}
{
${6:/***
* $7
*/}
function ${8:__construct}(${9:argument}) {
${0:# code...}
@andersonfraga
andersonfraga / Routes.php
Created June 6, 2012 14:41
Fiquei pensando muito sobre o que li, esses dias, quanto à idéia de 'NO-COMPLICATED-CONTROLLERS'. Estou afim de implementar algo do tipo abaixo. Talvez seja bacana. Talvez não...
<?php
namespace Test;
use Eflop\Dispatcher\Router\Handlers\Post;
use Eflop\Dispatcher\Router\Register;
$register = new Register();
// Home
class NewsController {
@Inject
private News news;
@Inject
private Author authors;
array respond_to() {