Skip to content

Instantly share code, notes, and snippets.

View augustohp's full-sized avatar

Augusto Pascutti augustohp

View GitHub Profile
@augustohp
augustohp / git-fix-authors.sh
Created April 7, 2012 02:56
Fix authors in a given commit
# http://code.google.com/p/rhythmbox-shoutcast/wiki/GitFixAuthor
git filter-branch --commit-filter '
if [ "$GIT_AUTHOR_NAME" = "axet" ];
then
GIT_AUTHOR_NAME="Alexey Kuznetsov";
GIT_AUTHOR_EMAIL="<[email protected]>";
git commit-tree "$@";
else
git commit-tree "$@";
fi' -- --all
@augustohp
augustohp / sql_formater.php
Created April 10, 2012 19:21
SQL formater for PHP by @alganet
function formatSql($sql) {
return preg_replace(
'/(select|from|(left |right |natural |inner |outer |cross |straight_)*join|where|limit|update |set|insert |values)/i',
"\n$1\n ", str_replace("\n", '', $sql)
);
}
@augustohp
augustohp / fix_short_open_tags.sh
Created April 17, 2012 18:03
Fix short open tags
# Gets all the files that has short_open_tags for PHP in the currently directory (recursively)
for filename in `grep -r '<? ' . | grep -v '.git' | cut -d : -f 1 | sort | uniq` then
# Changes all short_open_tags in the file to <?php
sed 's/<\? /<\?php /g' $filename > /tmp/a && mv /tmp/a $filename
done
@augustohp
augustohp / hackathon-0.0.4.sql
Created May 12, 2012 17:58
Banco de dados para normalização de dados da API
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL';
DROP SCHEMA IF EXISTS `hackathon_cmsp` ;
CREATE SCHEMA IF NOT EXISTS `hackathon_cmsp` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ;
USE `hackathon_cmsp` ;
-- -----------------------------------------------------
-- Table `hackathon_cmsp`.`politico`
@augustohp
augustohp / .profile
Created May 23, 2012 00:30
Some future for .profile
# Future ~/.profile
# http://git.io/.profile
@augustohp
augustohp / burp.md
Created June 21, 2012 02:16
How to code drunk

How to code drunk

Some people born with it, some people are self-taught on this, some people just discover how. How about a guide on how to code great software while still drunk as a cow?

Rules

  • You can add your patterns by forking this gist.
  • You must be drunk before sending a pattern.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
@augustohp
augustohp / runner.php
Created August 25, 2012 03:48
Storing tests in DI container [Work in Progress]
<?php
use Respect\Config\Container;
$config = new Container('config/tests.ini');
$tests = $config->tests; //Respect\Test\Suite
print $tests->description; // INI property
foreach ($tests->find() as $result) { //Respect\Test\Unit
print $result; //Respect\Test\Result
@augustohp
augustohp / install-bananajour-ubuntu-12.04.sh
Created August 31, 2012 17:21
[how-to] Install Bananajour in Ubuntu 12.04
#!/bin/bash
#
# Bananajour: https://github.com/toolmantim/bananajour
sudo apt-get install libavahi-compat-libdnssd-dev libdaemons-ruby1.8 libeventmachine-ruby1.8 libopenssl-ruby1.8 librack-ruby1.8 thin1.8;
sudo gem install dnssd bananajour;
@augustohp
augustohp / gist:3734944
Created September 17, 2012 00:14 — forked from netojoaobatista/gist:3716209
histórico do chat do Hangout sobre PHP
esse alganet é uma figura ^^ kkkk
Ruan_Aragao: Jamaicaaa kkkk
DavidRamires: Manual fantastico!
danjesus: netojoaobatista, sem d?vida ? o melhor manual
augustohp: +1
Ruan_Aragao: Demais!
danjesus: e os coment?rios s?o foda
poultwo: total
Denise: Manual PHP, Like, +1
Ruan_Aragao: Ele é muito mais vivo que eu :-S