Skip to content

Instantly share code, notes, and snippets.

@panquetofobia
panquetofobia / rpad.js
Created January 14, 2011 20:04
A simple rpad funciton
function rpad(txt, n, c) {
// padding length
n = n || 15;
// character to fill the string
c = c || ' ';
for (var p = 0, diff = n - txt.length; diff && p < diff; txt += c, p++);
return txt;
}
#!/bin/sh
# Instalación: Copiar y pegar en ~/.bash_profile.
#
# Cambia los colores del prompt y muestra el branch del directorio actual.
#
# Ejemplo:
# [ardilla:~]$ cd /usr/local/sitios/enlatele
# [ardilla:enlatele[v3]]$ git branch
# master
# newimporter
#!/usr/bin/env/python
"""
This script is executed through the post-receive hook
after a git repo receives data (someone git-pushed)
and notifies subscribers of the event via growl.
depends on the netgrowl module http://the.taoofmac.com/space/projects/netgrowl
"""
# Expand tabs in php files.
$ for i in $(find ./* -iname "*.php"); do awk '{sub("\t"," ",$0); print $0}' $i > ~/e.tmp && cat ~/e.tmp > $i; done
@panquetofobia
panquetofobia / shortags_fixer.php
Created March 24, 2010 19:49
PHP short open tags fixer
<?php
/**
* Short Open Tags fixer.
*
* Usage:
* $ php -d short_open_tag=On -f shortags_fixer.php path/to/file.php
* $ for i in $(find ./ -iname "*.phtml"); do php -d short_open_tag=On -f shortags_fixer.php $i > ~/fixed.txt && cat ~/fixed.txt > $i; done
*/
function fix($file)