Skip to content

Instantly share code, notes, and snippets.

View nebiros's full-sized avatar

Juan Alvarez nebiros

View GitHub Profile
@nebiros
nebiros / ErrorController.php
Created January 15, 2010 18:40
Display AJAX errors on Zend Framework
<?php
class ErrorController extends Zend_Controller_Action
{
public function errorAction()
{
/** Other suff */
if ( true === $this->getRequest()->isXmlHttpRequest() )
{
@nebiros
nebiros / App_Thumb.php
Created February 23, 2010 15:06
Thumbnails lib
<?php
class App_Thumb
{
protected $_width = null;
protected $_oldWidth = null;
protected $_height = null;
protected $_oldHeight = null;
protected $_imagePath = null;
protected $_resource = null;
@nebiros
nebiros / csvn.bat
Created June 13, 2010 19:52
Remove .svn folders on *nix and windoze
FOR /F "tokens=*" %G IN ('DIR /B /AD /S *.svn*') DO RMDIR /S /Q %G
@nebiros
nebiros / titanium_hold_menu.js
Created September 12, 2010 20:42
Titanium hold menu
var holdTime = 2000, timeout;
productView.addEventListener( "touchstart", function ( e ) {
timeout = setTimeout( function( e ) {
// you function here. e.source is you tableViewRow.
var dialog = Titanium.UI.createOptionDialog( {
options: ["Notificar precio"],
destructive: 2,
cancel: 1,
title: "Opciones"
@nebiros
nebiros / Cache.php
Created September 23, 2010 16:20
App_Cache
<?php
/**
* Based on FileCache class by Erik Giberti,
* http://af-design.com/blog/2010/07/30/simple-file-based-caching-in-php/
*
* @author nebiros
*/
class App_Cache {
/**
@nebiros
nebiros / Mysql.php
Created October 3, 2010 04:10
Mysql ala OOP, wrapper for some mysql_* functions
<?php
/**
* Mysql wrapper, to handle some mysql_* functions in a OOP way.
*
*/
class App_Db_Mysql {
const DEFAULT_ROW_COUNT = 10;
const DEFAULT_PAGE = 1;
@nebiros
nebiros / Bootstrap.php
Created December 1, 2010 14:50
Zend Framework bootstrap hacks and features
<?php
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap {
/**
*
* @return void
*/
protected function _initRouting() {
/* @var $fc Zend_Controller_Front */
$fc = $this->getPluginResource( "frontcontroller" )->getFrontController();
def tip(msg); puts; puts msg; puts "-"*100; end
#
# 30 Ruby 1.9 Tips, Tricks & Features:
# http://www.igvita.com/2011/02/03/new-ruby-19-features-tips-tricks/
#
tip "Upgrading to Ruby 1.9 is simple: rvm install 1.9.2 && rvm --default 1.9.2"
tip "Ruby 1.9 supports named captures in regular expressions!"
@nebiros
nebiros / xhprof for mac
Created April 6, 2011 17:05
xhprof for mac
# brew install re2c graphviz
# cd /tmp
# wget http://pecl.php.net/get/xhprof-0.9.2.tgz
# tar -xvzf xhprof-0.9.2.tgz
# cd xhprof-0.9.2/extension
# phpize
# MACOSX_DEPLOYMENT_TARGET=10.6 CFLAGS="-arch i386 -arch x86_64 -g -Os -pipe -no-cpp-precomp" CCFLAGS="-arch i386 -arch x86_64 -g -Os -pipe" CXXFLAGS="-arch i386 -arch x86_64 -g -Os -pipe" LDFLAGS="-arch i386 -arch x86_64 -bind_at_load"
# export CFLAGS CXXFLAGS LDFLAGS CCFLAGS MACOSX_DEPLOYMENT_TARGET
# ./configure --with-php-config=/usr/local/zend/bin/php-config
# make
module Feedzirra
module Parser
class FlickrEntry
include SAXMachine
include FeedEntryUtilities
element :guid, :as => :id
element :link, :as => :url