Skip to content

Instantly share code, notes, and snippets.

View handrus's full-sized avatar

Handrus Stephan Nogueira handrus

View GitHub Profile
@handrus
handrus / Crud.php
Created December 2, 2011 16:43
Classe abstrata de crud
<?php
/**
* Classe abstrata para funcionalidade de CRUD
* @author Daniel Lima <[email protected]>
* @example
* <code>
* <?php
* Module_Foo_Controller extexds Cilens_Controller_Crud
* {
* protected $_modelName = 'Foo';
@handrus
handrus / php_zip.inc
Created April 11, 2012 16:27
Zip files on php without ZIP library
<?php
// $Id$
/**
* @file
* Zip class for servers without ziplib.
*/
class PHPZip {
function Zip($dir, $zipfilename) {
if (@function_exists('gzcompress')) {
@handrus
handrus / .htaccess
Created May 21, 2013 16:15
htacess tuned for better performance. Tested with yslow and pagespeed
<IfModule mod_expires.c>
# Enable the module
ExpiresActive On
# Default expiration of 2 weeks
ExpiresDefault A1209600
# Expire CSS, JS and images content after 1 day.
ExpiresByType text/css "access plus 1 day"
ExpiresBytype text/javascript "access plus 1 day"
@handrus
handrus / CommentTrick.php
Last active December 17, 2015 19:48
Active/Deactive code trick
<?php
//*
myFunction();
//*/
/*
myFunction();
//*/
@handrus
handrus / gist:8835872
Created February 5, 2014 23:59
Faster git clone for large repositories
git clone --depth 1 https://github.com/CocoaPods/Specs
@handrus
handrus / pre-commit
Last active August 29, 2015 13:56 — forked from skwashd/pre-commit
#!/bin/bash
#
# Git pre-commit hook for Drupal projects.
# Created by Dave Hall - http://davehall.com.au
#
# Changed by Handrus Nogueira and Luiz Petri
#
# Distributed under the terms of the WTFPL - http://www.wtfpl.net/
#
#! /usr/bin/env python2
# Requires: PIL, colormath
#
# Improved algorithm now automatically crops the image and uses much
# better color matching
from PIL import Image, ImageChops
from colormath.color_objects import RGBColor
import argparse
import math
@handrus
handrus / gist:bd7771655258c721723e
Created August 8, 2014 20:22
Faster elementary OS Luna
#if you only use apps in english do not download other languages
sudo vim /etc/apt/apt.conf.d/00aptitude
#Add this line on the end
Acquire::Languages "none";
#remove zeitgeist, gnome online indicator and telepathy and shitty apps
zeitgeist-daemon --quit
sudo apt-get --purge autoremove deja-dup indicator-messages empathy-* gnome-online-accounts activity-log-manager-common activity-log-manager-control-center zeitgeist zeitgeist-core zeitgeist-datahub midori-granite noise software-center scratch-text-editor modemmanager geary
sudo apt-get autoremove
sudo apt-get autoclean
@handrus
handrus / README1.md
Last active August 29, 2015 14:07
Curso Oglivy

##Instalar drush, yeoman e usando phpcs com Drupal coder.

sudo apt-get install curl php-pear nodejs
sudo pear channel-discover pear.drush.org
sudo pear install drush/drush
sudo drush version

sudo ln -s /usr/bin/nodejs /usr/bin/node
sudo npm install -g yo
@handrus
handrus / Default (Linux).sublime-keymap
Created February 4, 2015 21:04
Sublime preferences and project template
[
{ "keys": ["ctrl+super+t"], "command": "phpcs_clear_sniffer_marks" },
{ "keys": ["alt+d"], "command": "goto_definition" },
{ "keys": ["ctrl+super+d"], "command": "goto_drupalapi" }
]