Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View filhodanuvem's full-sized avatar
👋

Claudson Oliveira filhodanuvem

👋
View GitHub Profile
; Possible bug on Respect/Config. Test and open an issue.
; MONOLOG
[redisMonologHandler Monolog\Handler\StreamHandler]
[monolog Monolog\Logger]
name = phartitura
handlers = [[redisMonologHandler],]
; handlers = [[redisMonologHandler]] <----- without comma, it's not parsed and the library throws an error
; Object of class Respect\Config\Instantiator could not be converted to string in .. /vendor/respect/config/library/Respect/Config/Container.php on line 317
@filhodanuvem
filhodanuvem / gist:1282780
Created October 12, 2011 22:02
testing exceptions on TwitterValidator
<?php
namespace Respect\Validation\Rules;
use Respect\Validation\Exceptions\ComponentException;
class Twitter extends AbstractRule
{
private $pattern = '/^@[a-zA-Z0-9]/';
private $account = NULL;
@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;
@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 / 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: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 / 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: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 / 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: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