Skip to content

Instantly share code, notes, and snippets.

View nebiros's full-sized avatar

Juan Alvarez nebiros

View GitHub Profile
@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
@nebiros
nebiros / _yerb.rb
Created June 16, 2011 14:46 — forked from josevalim/_yerb.rb
Who needs HAML when you have YAML + ERB?
# = YERB
#
# Who needs HAML when you have YAML + ERB? ;)
#
# See example.yaml below for an example. You can run this code
# by cloning this gist and then `ruby _yerb.rb example.yaml`.
#
# Notice that you need Ruby 1.9 so the hash order is preserved.
# Obviously, this is just for fun. Definitely slow as hell.
#
@nebiros
nebiros / application.httpd
Created June 18, 2011 15:50 — forked from wilmoore/application.httpd
Bootstrapping a multi-environment ZF 1.x application
<VirtualHost *:80>
ServerName ##APP_DOMAIN##
ServerAlias www.##APP_DOMAIN##
ServerAlias ##APPLICATION_ENV##.www.##APP_DOMAIN##
ServerAlias ##APPLICATION_ENV##.##APP_DOMAIN##
ServerAdmin admin@##APP_DOMAIN##
SetEnv APPLICATION_ENV ##APPLICATION_ENV##
SetEnv SERVER_HOSTNAME ##SERVER_HOSTNAME##
Header append X-Host-List "%{SERVER_HOSTNAME}e"
$ brew install -vd emacs --cocoa --srgb
==> Downloading http://ftp.gnu.org/pub/gnu/emacs/emacs-23.3.tar.bz2
File already downloaded in /Users/nebiros/Library/Caches/Homebrew
/usr/bin/tar xf /Users/nebiros/Library/Caches/Homebrew/emacs-23.3.tar.bz2
==> Downloading patches
/usr/bin/curl -f#LA Homebrew 0.8 (Ruby 1.8.7-249; Mac OS X 10.7) http://repo.or.cz/w/emacs.git/commitdiff_plain/c8bba48c5889c4773c62a10f7c3d4383881f11c1 -o 001-homebrew.diff https://raw.github.com/gist/1012927 -o 002-homebrew.diff
######################################################################## 100.0%
######################################################################## 100.0%
==> Patching
/usr/bin/patch -f -p1 -i 001-homebrew.diff
@nebiros
nebiros / gist:1139649
Created August 11, 2011 13:29
My git svn workflow
# clone svn repo, -s means standar svn repo (trunk, branches, tags)
$ git svn clone file:///tmp/test-svn -s
# branches list
$ git branch -a
$ git repack -d
# creates and jump to the new branch
$ git checkout -b new_branch
# add changes
$ git add <FILE>
# commit changes to the current branch
@nebiros
nebiros / gist:1324046
Created October 29, 2011 03:47
soprano formula error
$ brew install soprano
==> Downloading http://downloads.sourceforge.net/project/soprano/Soprano/2.6.0/soprano-2.6.0.tar.bz2
File already downloaded in /Users/nebiros/Library/Caches/Homebrew
==> cmake . -DCMAKE_INSTALL_PREFIX='/usr/local/Cellar/soprano/2.6.0' -DCMAKE_BUILD_TYPE=None -Wno-dev
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Checking whether C compiler has -isysroot
-- Checking whether C compiler has -isysroot - yes
-- Checking whether C compiler supports OSX deployment target flag
-- Checking whether C compiler supports OSX deployment target flag - yes