Skip to content

Instantly share code, notes, and snippets.

View filhodanuvem's full-sized avatar
👋

Claudson Oliveira filhodanuvem

👋
View GitHub Profile
@filhodanuvem
filhodanuvem / gist:4215135
Created December 5, 2012 12:26
How to test php 5.5
cd ~
wget http://downloads.php.net/dsp/php-5.5.0alpha1.tar.gz
tar -vzxf php-5.5.0alpha1.tar.gz
cd php-5.5.0alpha1/
./configure
make
make test
<?php
/**
* Comentario do arquivos
*
* @author Vinícius Fontoura <vinicius@aprimorar.com>
* @copyright 2012 Aprimorar Desenvolvimento Ltda(c)
* @version SVN: $Rev$ $LastChangedDate$ $LastChangedBy$
*/
@filhodanuvem
filhodanuvem / gist:3782362
Created September 25, 2012 14:45
O que uma lib php deveria ter como funcionalidades para manipular "objetos" do Facebook

FARpa TO DO list

O que uma lib php deveria ter como funcionalidades para manipular "objetos" do Facebook ?

Primeiras Entidades

  • User
  • Album
@filhodanuvem
filhodanuvem / composer.json
Created July 3, 2012 00:15
FaceApp scaffold
{
"name" : "NomeDoProjeto",
"autoload" : {
"psr-0" : { "NomeDoProjeto" : "src/"}
},
"minimum-stability": "dev" ,
"license" : "MIT",
"authors": [
{
"name": "Claudson Oliveira",
@filhodanuvem
filhodanuvem / gist:2828702
Created May 29, 2012 14:20
PHP não tem closure?
<?php
$lambda = function() use($nota){
echo '<br />'.$nota;
};
function soma($v1,$v2,$f){
$nota = $v1 + $v2 ;
$f();
}
@filhodanuvem
filhodanuvem / gist:1707824
Created January 31, 2012 00:32
Testando se uma regra existe no Respect\Validation
<?php
// A ideia é descobrir se a regra existe
// ex: $p['validate'] == 'image'
// Usei a SplClassLoader para carregar o Respect, porém, acho que na hora da biblioteca instanciar uma
// regra via Reflection, o autoload dá require num arquivo que nao existe, gerando um erro fatal
// ou seja, que não é capturado pelo try...catch.
use Respect\Validation as v;
$validator = new v\Validator();
@filhodanuvem
filhodanuvem / gist:1633679
Created January 18, 2012 15:53
Simple example Annotation
<?php
class Foo extends Model
{
/**
* @var int
*/
protected $value;
public function getValue(){
return $this->value;
@filhodanuvem
filhodanuvem / config.php
Created January 18, 2012 01:33
examples from simpleAnnotation
<?php
$proj = substr(__DIR__,0,strrpos(__DIR__, '/'));
$root = substr($proj,0,strrpos($proj, '/'));
set_include_path($root . PATH_SEPARATOR. $proj . PATH_SEPARATOR. get_include_path());
function loader($class_name)
{
$path = str_replace('\\','/',($class_name)).'.php';
@filhodanuvem
filhodanuvem / gist:1622299
Created January 16, 2012 18:49
Testing closure
<?php
$h = date('H', strtotime($agenda->getData()));
$horariosPossiveis = array_map(function($v){
return str_replace('%H%', $h,$v);
},$horariosPossiveis);
@filhodanuvem
filhodanuvem / Twitter.php
Created October 13, 2011 11:02
Trying add templates in TwitterExcept
<?php
namespace Respect\Validation\Rules;
use Respect\Validation\Exceptions\ComponentException;
class Twitter extends AbstractRule
{
private $pattern = '/^@[a-zA-Z0-9]/';
private $curl = NULL;