Skip to content

Instantly share code, notes, and snippets.

View augustohp's full-sized avatar

Augusto Pascutti augustohp

View GitHub Profile

Keybase proof

I hereby claim:

  • I am augustohp on github.
  • I am augustohp (https://keybase.io/augustohp) on keybase.
  • I have a public key whose fingerprint is BC17 089B E946 FA41 10BE 422F 0C63 DBDD 93E2 C95D

To claim this, I am signing this object:

@augustohp
augustohp / jekyll
Last active August 29, 2015 14:00
Jekyll init script for debian (serves Ubuntu).
#!/bin/bash
#
# Jekyll is a Ruby based website/blog generator, this is his
# (unnoficial) init script. Tested with Jekyll 1.5.
# Author: Augusto Pascutti <augusto.hp@gmail.com>
set -o errexit
set -o pipefail
[[ $DEBUG ]] && set -x
@augustohp
augustohp / run.php
Created May 30, 2014 02:30
Usar array estoura a memória do PHP.
<?php
function printResults()
{
$startOfRequest = $_SERVER['REQUEST_TIME'];
$memoryUsed = formatBytes(memory_get_usage());
$memoryPeak = formatBytes(memory_get_peak_usage());
echo <<<EOT
Memory usage: $memoryUsed
Memory peak: $memoryPeak
#!/bin/bash
# /etc/init.d/xvfb_daemon
# Debian-compatible Xvfb startup script.
# Tom Meier <tom@venombytes.com>
# Jeffery Fernandez <jeffery@fernandez.net.au>
#
### BEGIN INIT INFO
# Provides: xvfb_daemon
# Required-Start: $remote_fs $syslog $network
# Required-Stop: $remote_fs $syslog $network
@augustohp
augustohp / SplClassLoader.php
Created October 16, 2010 07:22 — forked from jwage/SplClassLoader.php
Little mod for not breaking class_exists() usage with non-existing classes, preventing a Fatal Error
<?php
/**
* SplClassLoader implementation that implements the technical interoperability
* standards for PHP 5.3 namespaces and class names.
*
* http://groups.google.com/group/php-standards/web/final-proposal
*
* // Example which loads classes for the Doctrine Common package in the
* // Doctrine\Common namespace.
@augustohp
augustohp / brew_highlight
Created July 9, 2011 04:57
Brew Error: brew install -v highlight
==> Downloading http://www.andre-simon.de/zip/highlight-3.5.tar.bz2
File already downloaded in /Users/pascutti/Library/Caches/Homebrew
/usr/bin/tar xf /Users/pascutti/Library/Caches/Homebrew/highlight-3.5.tar.bz2
==> make PREFIX=/usr/local/Cellar/highlight/3.5 conf_dir=/usr/local/etc/highlight
make PREFIX=/usr/local/Cellar/highlight/3.5 conf_dir=/usr/local/etc/highlight
make -C ./src -f ./makefile HL_DATA_DIR=/usr/local/Cellar/highlight/3.5/share/highlight/ HL_CONFIG_DIR=/usr/local/etc/highlight
c++ -Wall -O2 -O3 -march=core2 -msse4.1 -w -pipe -DNDEBUG -c -I ./include/ -I/usr/include/lua5.1 ./core/stylecolour.cpp
c++ -Wall -O2 -O3 -march=core2 -msse4.1 -w -pipe -DNDEBUG -c -I ./include/ -I/usr/include/lua5.1 ./core/stringtools.cpp
c++ -Wall -O2 -O3 -march=core2 -msse4.1 -w -pipe -DNDEBUG -c -I ./include/ -I/usr/include/lua5.1 ./core/xhtmlgenerator.cpp
c++ -Wall -O2 -O3 -march=core2 -msse4.1 -w -pipe -DNDEBUG -c -I ./include/ -I/usr/include/lua5.1 ./core/latexgenerator.cpp
@augustohp
augustohp / SingletonPattern.php
Created October 3, 2011 18:23
PHP Singleton implementation example
<?php
class SingletonPattern
{
private static $instance;
private function __construct()
{
}
@augustohp
augustohp / silly.me.php
Created October 24, 2011 08:48
A silly database interaction implementation
<?php
function examples() {
$say = new Sql();
echo $say->what->happens->when->you->think->out->of->the->box->raw('?'),"\n\n";
// Our database
$pdo = new Pdo('sqlite::memory:');
//$pdo = new Pdo('mysql:dbname=test;host=127.0.0.1', 'zend', '');
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
@augustohp
augustohp / mapper_uc1.php
Created November 23, 2011 13:01
Data Mapper use case
<?php
$map = array('id'=>'id', 'login'=>'login', 'passwd'=>'passwd');
$origin = array('id'=>1, 'login'=>'foo', 'passwd'=>'bar');
$mapper = new Respect\Data\Mapper($map);
$object = new StdClass;
$mapper->toInstance($origin, $object);
@augustohp
augustohp / gist:1402858
Created November 29, 2011 01:03 — forked from wesleyvicthor/gist:1392133
twig array
{% if cases_list.ProcessInstance is defined %}
{% for case in cases_list.ProcessInstance %}
{% for activity in case.activities.children() %}
<tr>
{% for variable in case.clientVariables.children() %}
{{ set value = variable.xpath('string[2]') }}
<td>{{ array_pop(value) }}</td>
{% endfor %}
<td><a href="{{ cloud_link_address }}{{ activity.uuid.value }}" target="_blank">{{ activity.name }}</a></td>
<td>#</td>