Skip to content

Instantly share code, notes, and snippets.

View galvao's full-sized avatar
😎
Rocking to the rythm of the sure shot beat

Er Galvão Abbott galvao

😎
Rocking to the rythm of the sure shot beat
View GitHub Profile
@galvao
galvao / ASCIITable.sh
Last active August 29, 2015 13:58
Print ASCII Table in Terminal (yep, Linux rules, bitches!)
#From Command Line Fu (http://www.commandlinefu.com/commands/view/13310/print-ascii-character-chart)
for i in {1..256};do p=" $i";echo -e "${p: -3} \\0$(($i/64*100+$i%64/8*10+$i%8))";done|cat -t|column -c120
@galvao
galvao / rmd.sh
Created April 21, 2014 17:05
Recording a Screencast (with sound and a delay of 10 seconds before recording starts)
#Usage: rmd.sh CourseName Lesson
cd /home/zaphod/Documents/Cursos/CodeSquad/$1/$2
recordmydesktop --delay 10 -o $2.ogv
<?php
// =P
$a = array('Chelsea', 'Liverpool', 'Manchester United', 'Manchester City');
$b = array('e', array_pop($a));
echo implode(', ', $a) . ' ' . implode(' ', $b);
@galvao
galvao / funcao.alg
Created July 22, 2014 10:16
Exemplo de função em Portugol para aulas de lógica
algoritmo "semnome"
var
x, r: inteiro
funcao somaum(y,): inteiro
inicio
y <- y + 1
retorne y
fimfuncao
@galvao
galvao / addModule.php
Created July 22, 2014 18:03
Make sure you only add your module's custom path to composer's autoloader once.
<?php
$loader = require_once 'vendor/autoload.php';
if (!in_array('ModuleName', array_keys($loader->getPrefixes()))) {
$loader->add("ModuleName", "/path/to/module");
}
@galvao
galvao / functionception.php
Created September 5, 2014 01:16
On what I call "functionception" (see comment)
<?php
/* Proper way to fix this: https://github.com/kriwil/OpenX/blob/6804041a8f74d80f6fae4df3320576cc3bba06ff/pre-check.php#L252
Note that phpversion is also implemented in PHP4, but couldn't find the correct minor in which it was added, but let's
face it: If you're running PHP prior to 4.3, you're already doing a lot of wrong sh*t.
Also, can't find the correct minor on which function_exists was added, but it seems to begin working properly as of 4.3.0.
*/
if ((float)phpversion() > 4.3) {
}

Keybase proof

I hereby claim:

  • I am galvao on github.
  • I am galvao (https://keybase.io/galvao) on keybase.
  • I have a public key whose fingerprint is BCA9 8ACC B247 1B55 4FBC DB96 9246 31FF 2E61 797E

To claim this, I am signing this object:

Verifying that +galvao is my Bitcoin username. You can send me #bitcoin here: https://onename.io/galvao
@galvao
galvao / Crawler.php
Created February 28, 2015 13:40
Uma classe que faz o crawl em um filesystem. Exemplo de uso do PHP fora da web.
<?php
//namespace Crawler;
/**
* Crawler - part of the PHP Filesystem Tools
*
* Given an initial path, crawls into it's subdirectories and gather files, directories and symlinks.
* Can follow symlinks and/or crawl recursively.
*
* @package phpft
@galvao
galvao / db.sql
Created May 31, 2015 05:33
Criação da base de dados de exemplo da Aula 4 do curso PHP & Segurança da CodeSquad
-- MySQL Workbench Forward Engineering
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,ALLOW_INVALID_DATES';
-- -----------------------------------------------------
-- Schema mydb
-- -----------------------------------------------------