Skip to content

Instantly share code, notes, and snippets.

View mrpollo's full-sized avatar
Journey before destination

Ramon Roche mrpollo

Journey before destination
View GitHub Profile
@mrpollo
mrpollo / Perl Downloader
Created August 3, 2011 23:05
Perl script to download files from a list on a text file
#!/opt/local/bin/perl
# Example of contents of urllist.txt
# http://google.com/
# http://yahoo.com/
# http://autos.yahoo.com
# http://autos.yahoo.com/sedans/all.html
# http://autos.yahoo.com/sedans/luxury.html
use POSIX;
use URI;
@mrpollo
mrpollo / .vimrc
Created August 16, 2011 17:14
My Vim configuration settings
set nocompatible
set number
set ruler
syntax on
" Set encoding
set encoding=utf-8
" Whitespace stuff
@mrpollo
mrpollo / Hombrew ImageMagick
Created September 13, 2011 20:25
Error installing ImageMagick with Hombrew
==> Installing imagemagick dependency: libtiff
==> Downloading ftp://ftp.remotesensing.org/pub/libtiff/tiff-3.9.5.zip
curl: (7) couldn't connect to host
Error: Failure while executing: /usr/bin/curl -f#LA Homebrew\ 0.8\ (Ruby\ 1.8.7-249;\ Mac\ OS\ X\ 10.7.1) ftp://ftp.remotesensing.org/pub/libtiff/tiff-3.9.5.zip -o /Users/rroche/Library/Caches/Homebrew/libtiff-3.9.5.zip
@mrpollo
mrpollo / Hombrew ImageMagick Fix
Created September 13, 2011 20:27
Fix for installing ImageMagick with Hombrew
$ /usr/bin/curl http://download2.osgeo.org/libtiff/tiff-3.9.5.zip -o ~/Library/Caches/Homebrew/libtiff-3.9.5.zip
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1792k 100 1792k 0 0 230k 0 0:00:07 0:00:07 --:--:-- 279k
$ brew install imagemagick
@mrpollo
mrpollo / gettext po generator
Created September 27, 2011 05:11
A basic bash script to generate a po file from a project directory, it will recursively find inside it i added some exclusions to remove some framework libraries
#!/bin/bash
for FILENAME in `/usr/bin/find $1 -iname "*.php" | /usr/bin/grep -v -w "Zend\|dompdf\|includes/font\|ZendFramework\|json\|phpmailer"`
do
echo $FILENAME
`/usr/local/bin/xgettext -o lib_amce/langs/en_US/LC_MESSAGES/messages.po --join-existing --from-code=utf-8 --keyword=translate --keyword -L Python $FILENAME`
done
exit;
@mrpollo
mrpollo / Fix para Azteca Deportes
Created October 12, 2011 02:35
Fix para Azteca Deportes
javascript:(function(){function fetchJson(){var jsonSource;jsonSource='json2.php';clearTimeout(mainTimer);var jsonRequest=new Request.JSON({url:jsonSource,onSuccess:function(json){if(json){deployJson(json);if(json.extra.length>0){if($('lt-regularbar').getStyle('width').toInt()!=610)tlTween.start('width','610')}if(json.matchdata.finished=='true')gameOver=true}if(gameOver==false)mainTimer=fetchJson.delay(mainDelay)}}).post({'fullObj':fullObj,'last':last,'lastExtra':lastExtra,'match':match,'datematch':datematch})}$('lt-restore').fade('hide');$('lt-restore').setStyle('display','block');if($('lt-vodset')){$('lt-vodset').fade('hide');if(Browser.Platform.ios){var gestureOverlay=new Element('div',{'id':'gestureOverlay','style':'width:480px;height:100%;position:absolute;z-index:1;top:0px;left:245px;background:url(images/alpha50.png);'});var gestureImg=new Element('img',{'src':'images/2fingerscroll.png','style':'position:absolute;top:85px;left:105px;','width':'223','height':'197','alt':''});gestureImg.inject(gestureOve
@mrpollo
mrpollo / EventManager_Framework_Rest
Created December 16, 2011 07:21
Extending Zend_Rest_Server to use namespaces
<?php
class EventManager_Framework_Rest extends Zend_Rest_Server
{
/**
* Implement Zend_Server_Interface::setClass()
*
* @param string $classname Class name
* @param string $namespace Class namespace (unused)
* @param array $argv An array of Constructor Arguments
*/
@mrpollo
mrpollo / iFrame resize with MooTools 1.12
Created December 20, 2011 19:51
MooTools 1.12 and Earlier iFrame resize, mainly used for Joomla compatibility
window.addEvent('domready', function(){
function resizeIframe( iframe ){
var innerDoc = $( ( iframe.contentWindow ) ? iframe.contentWindow.document.body : iframe.contentDocument.body ) );
var objToResize = (iframe.style) ? iframe.style : iframe;
var sizes = innerDoc.getSize();
var offsetHeight = sizes.scrollSize.y + 50;
objToResize.height = offsetHeight + 'px';
}
if( $('iframe') != null ){
var iframe = $('iframe');
@mrpollo
mrpollo / FLAC to ALAC in FFMPEG
Created January 5, 2012 21:16
just a tiny script/utility to convert all the flac files in a folder to Apple Lossless codec 'alac'
#!/bin/bash
for f in *.flac; do ffmpeg -i "$f" -acodec alac "${f%.flac}.m4a"; done
@mrpollo
mrpollo / FF | CDFF
Created March 14, 2012 16:52
Finder functions for bash
# Get the path to the last Finder window with focus
function ff {
osascript -e 'tell application "Finder"'\
-e "if (${1-1} <= (count Finder windows)) then"\
-e "get POSIX path of (target of window ${1-1} as alias)"\
-e 'else' -e 'get POSIX path of (desktop as alias)'\
-e 'end if' -e 'end tell';
}
# Get into the result of `ff`