Skip to content

Instantly share code, notes, and snippets.

@raphaeldealmeida
raphaeldealmeida / gist:5037896
Created February 26, 2013 11:42
Erro vagrant-oracle-xe
raphael@SIGPES-RAPHAEL:~/Downloads/vagrant-oracle-xe$ vagrant up
[oraxe] VM already created. Booting if it's not already running...
[oraxe] Clearing any previously set forwarded ports...
[oraxe] Forwarding ports...
[oraxe] -- 22 => 41022 (adapter 1)
[oraxe] Creating shared folders metadata...
[oraxe] Clearing any previously set network interfaces...
[oraxe] Preparing network interfaces based on configuration...
[oraxe] Running any VM customizations...
[oraxe] Booting VM...
@raphaeldealmeida
raphaeldealmeida / Skeleton.php
Last active December 13, 2015 19:09
A improvement for ZFTool works with proxy
<?php
namespace ZFTool\Model;
use Zend\Code\Generator\ValueGenerator;
class Skeleton
{
const SKELETON_URL = 'https://github.com/zendframework/ZendSkeletonApplication/archive/master.zip';
const API_LAST_COMMIT = 'https://api.github.com/repos/zendframework/ZendSkeletonApplication/commits?per_page=1';
raphael@curupira:~/Downloads/desenvolvimento/php-5.3.20$ make test TESTS=tests/output/bug63377.phpt
Build complete.
Don't forget to run 'make test'.
=====================================================================
PHP : /home/raphael/Downloads/desenvolvimento/php-5.3.20/sapi/cli/php
PHP_SAPI : cli
PHP_VERSION : 5.3.20
@raphaeldealmeida
raphaeldealmeida / base.pp
Created September 22, 2012 11:41
Arquivo de configuração Puppet
class base {
group { "puppet":
ensure => "present",
}
exec { "apt_update":
command => "apt-get update",
path => "/usr/bin"
}
@raphaeldealmeida
raphaeldealmeida / Date.php
Created February 25, 2012 06:38
Exemplo_phar
<?php
//colocar na pasta app
namespace MyApp;
class Date {
public static function next_week()
{
$datetime = new \DateTime();
$datetime->add(new \DateInterval('P7D'));
return $datetime->format('Y-m-d');
}
<?php
class Iterable implements IteratorAggregate{
protected $array;
function __construct(array $array = null ){
if(is_array($array))
$this->setArray($array);
}
function getArray(){
@raphaeldealmeida
raphaeldealmeida / gist:1885228
Created February 22, 2012 13:45
com closure
<?php
$lista = array(1, 3, 5, 7, 56, 65, 96, 244, 700, 892);
function criarFiltro($maiorQue){
return function ($x) use ($maiorQue){
return $x > $maiorQue;
};
}
$filtro100 = criarFiltro(100);
@raphaeldealmeida
raphaeldealmeida / gist:1885226
Created February 22, 2012 13:45
com closure
<?php
$lista = array(1, 3, 5, 7, 56, 65, 96, 244, 700, 892);
function criarFiltro($maiorQue){
return function ($x) use ($maiorQue){
return $x > $maiorQue;
};
}
$filtro100 = criarFiltro(100);
@raphaeldealmeida
raphaeldealmeida / gist:1885222
Created February 22, 2012 13:44
sem closure
<?php
$lista = array(1, 3, 5, 7, 56, 65, 96, 244, 700, 892);
$filtro100 = function ($x){
return $x > 100;
};
$filtro50 = function ($x){
return $x > 50;
@raphaeldealmeida
raphaeldealmeida / late_static_binding.php
Created February 21, 2012 16:55
PHP 5.3 - Late Static Binding
<?php
class Foo{
protected static function speak(){
echo __METHOD__, "\n\r";
return 'Hi';
}
public static function sayHi(){
//return self::speak(); // PHP 5.2 <=