Skip to content

Instantly share code, notes, and snippets.

http://gbayer.com/development/moving-files-from-one-git-repository-to-another-preserving-history/
http://stackoverflow.com/questions/2314652/is-it-possible-to-move-rename-files-in-git-and-maintain-their-history
http://stackoverflow.com/questions/3142419/how-can-i-move-a-directory-in-a-git-repo-for-all-commits
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@thiagophx
thiagophx / pp
Created March 17, 2015 18:42
JSON Pretty Print Stream
#!/usr/bin/python -u
import sys, json
from pygments import highlight
from pygments.lexers import JsonLexer
from pygments.formatters import Terminal256Formatter
while True:
line = sys.stdin.readline()
if line.strip():
@thiagophx
thiagophx / HtmlHandler.php
Created February 11, 2012 00:09
ViewHandler
<?php
namespace MyApp;
class HtmlHandler implements ViewHandler
{
public function __invoke(Response $response)
{
foreach ($response->getHeaders() as $header)
header($header);
@thiagophx
thiagophx / spec-doc.php
Created December 31, 2011 20:56
Documentator Specification
<?php
class CompaniaAerea
{
protected $politicaOverbooking;
public function fazReserva(Voo $voo, $numPassageiros)
{
if (!$this->politicaOverbooking->permitida($voo, $numPassageiros))
throw new Exception('BLA');
@thiagophx
thiagophx / gist:1501488
Created December 20, 2011 12:53
Dependency Injection on .ini Files
; services.ini
[userService MyApp\Service\UserService]
options = [appContainer]
serviceLocator = [this]
; application.ini
; App configuration
url = "http://www.google.com"
db_host = "127.0.0.1"
@thiagophx
thiagophx / example.php
Created October 9, 2011 00:42
ServiceLocator in PHP
<?php
abstract class ServiceLocator
{
protected static $locator;
public static function load(ServiceLocator $locator)
{
self::$locator = $locator;
}
@thiagophx
thiagophx / benchmark.php
Created September 28, 2011 13:04
Object creation in PHP, which approach is faster? new, clone or unserialize???
<?php
function leSerialize()
{
for ($i = 0; $i < 1000; $i++)
unserialize('O:8:"stdClass":0:{}');
}
function leNew()
{