Skip to content

Instantly share code, notes, and snippets.

View alganet's full-sized avatar

Alexandre Gomes Gaigalas alganet

  • São Paulo, SP, Brazil
View GitHub Profile
@alganet
alganet / TypeFileOut.py
Last active August 29, 2015 14:26 — forked from stuartlangridge/TypeFileOut.py
Sublime Text 3 Python plugin to "type" the file that's currently being edited, character by character, for screencasts.
import sublime, sublime_plugin
BLOCKLEN = 1
class TypeFileOutCommand(sublime_plugin.TextCommand):
def nextchar(self):
if self.body:
totype = []
while 1:
try:

Regras do grupo

Para tópicos

Antes de abrir um novo tópico verifique se já não existe um outro tópico aberto com o mesmo assunto/dúvida. Verifique antes também possíveis soluções para as suas dúvidas no Google.

class Person {
public $name;
public $job;
public $year;
}
$person = new Person;
$person->name = 'Alexandre';
$person->job = 'Batedor de código fonte';
$person->year = new DateTime('2013');
<?php
class FluentCache extends \ArrayObject
{
private $cache;
public function __construct(\Doctrine\Common\Cache\Cache $cache, array $data = array())
{
$this->cache = $cache;
parent::__construct($data, static::ARRAY_AS_PROPS);
@alganet
alganet / mocks.php
Created March 27, 2012 17:22
Next-gen mocks and stubs for PHP 5.4
<?php
use FooBar\Test\Mock;
// In the sample below, $mock expects the method "sayHelloTo" to be called one time
// with the parameter $name equals "Alexandre" and return "Hello Alexandre"
$mock = (new Mock('NamespaceVendor\\ClassName'))([
'sayHelloTo' => function($name="Alexandre") {
return "Hello Alexandre";
#!/bin/bash
x=0;
repositories=(
"Cli"
"Config"
"Data"
"ed"
"Foundation"
"Framework"
"Http"
#!/bin/bash
BIND=127.0.0.1:9000
USER=www-data
PHP_FCGI_CHILDREN=1
PHP_FCGI_MAX_REQUESTS=1000
PHP_CGI=/usr/bin/php-cgi
PHP_CGI_NAME=`basename $PHP_CGI`
PHP_CGI_ARGS="- USER=$USER PATH=/usr/bin PHP_FCGI_CHILDREN=$PHP_FCGI_CHILDREN PHP_FCGI_MAX_REQUESTS=$PHP_FCGI_MAX_REQUESTS $PHP_CGI -b $BIND"
RETVAL=0
<?php
$teste = array(
array("foo" => "a", "bar" => "b", "timestamp" => 123456),
array("foo" => "a", "bar" => "b", "timestamp" => 987654),
array("foo" => "a", "bar" => "b", "timestamp" => 654789),
array("foo" => "a", "bar" => "b", "timestamp" => 456123)
);
function sortTimestamp($a, $b) {