Skip to content

Instantly share code, notes, and snippets.

View augustohp's full-sized avatar

Augusto Pascutti augustohp

View GitHub Profile
<?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 / 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.
@augustohp
augustohp / .profile
Created May 23, 2012 00:30
Some future for .profile
# Future ~/.profile
# http://git.io/.profile
@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 / 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 / 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 / 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 / php_singleton_test.php
Created March 31, 2012 05:37
A new way to make singleton in PHP?
<?php
/**
* @author: Garith
*/
class Singleton{
protected static $instance = null;
public static function load(){
if(self::$instance === null){
@augustohp
augustohp / index.php
Created March 30, 2012 22:18 — forked from alganet/index.php
Seamless Respect Framework
<?php
/**
* Example of usage of the "Respect Framework", that is actually
* just using one or more Respect components together.
*
* Using components in version 0.4.*
*/
use Respect\Validation\Validator as v;
use Respect\Rest\Router;
@augustohp
augustohp / yourmom.js
Created March 30, 2012 21:10 — forked from evert/yourmom.js
Greasemonkey script to change every utm_source link attribute value to 'Your mom'
// ==UserScript==
// @name Referral: your mom
// @namespace yourmom
// @description This script changes every utm_source variable in links to 'Your mom'.
// @include *
// ==/UserScript==
var links = document.getElementsByTagName('a');
for(var i=0; i<links.length; i++) {
links[i].href = links[i].href.replace(/([&|?])utm_source=(.*)([&|?|^])/,"$1utm_source=Your+mom$3");