Skip to content

Instantly share code, notes, and snippets.

View ecentinela's full-sized avatar

Javier Martínez Fernández ecentinela

  • Barcelona, Spain
View GitHub Profile
@ecentinela
ecentinela / Change author details in commit history
Created October 2, 2009 11:17
Change author / commiter details in all commits (WARNING: Will change all SHA1s)
#!/bin/sh
git filter-branch --env-filter '
an="$GIT_AUTHOR_NAME"
am="$GIT_AUTHOR_EMAIL"
cn="$GIT_COMMITTER_NAME"
cm="$GIT_COMMITTER_EMAIL"
if [ "$GIT_COMMITTER_EMAIL" = "your@email.to.match" ]
@ecentinela
ecentinela / jpg2pdf.rb
Created February 18, 2011 18:29
Convert multiple jpg files to a pdf document
# get the actual directory
root_path = Dir.pwd
# all files on the actual directory
Dir.glob(File.join root_path, '*').each do |file|
# check that is a directory
if File.directory? file
print "Converting #{file}... "
# path where image files are
@ecentinela
ecentinela / adb.sh
Created February 19, 2011 20:07
flash recovery HTC Hero
adb shell reboot bootloader
fastboot boot recovery-RA-hero-v1.7.0.1.img
adb shell mount /sdcard
adb push recovery-RA-hero-v1.7.0.1.img /sdcard/recovery-RA-hero-v1.7.0.1.img
adb shell flash_image recovery /sdcard/recovery-RA-hero-v1.7.0.1.img
adb shell reboot
#Importante: resetear el single_access_token de los usuarios que no tengan
cd /var/www/apps/pareja10/current
script/console staging (o production)
User.find_each do |u|
unless u.single_access_token?
u.reset_single_access_token
u.save(false)
end
end
# How to echobot with XMPP, BOSH, and Strophe
1. Setup ejabberd(http://www.ejabberd.im/) server and setup account admin@localhost.local
NOTE: localhost should be enough. If you setup something else, make sure you add it at /etc/hosts like this
#/etc/hosts
127.0.0.1 localhost.local
NOTE: Also download Psi(http://psi-im.org/), and make sure you can connect to your ejabberd server.
2. Download strophe(http://code.stanziq.com/strophe/) and place it (eg: /Users/makoto/work/sample/strophejs-1.0)
@ecentinela
ecentinela / auto_link_text.php
Created April 7, 2011 11:27
Creates links for urls on text
@ecentinela
ecentinela / phpunit
Created May 26, 2011 16:56
Install PHPUnit in MAMP
cd /Applications/MAMP/bin
ln -s php5.3 php5
php5/bin/pear channel-discover pear.phpunit.de
php5/bin/pear channel-discover components.ez.no
php5/bin/pear channel-discover pear.symfony-project.com
php5/bin/pear channel-update pear.php.net
php5/bin/pear upgrade pear
php5/bin/pear install phpunit/PHPUnit
ln -s /Applications/MAMP/bin/php5/bin/phpunit /usr/local/bin/phpunit
phpunit --version
@ecentinela
ecentinela / gist:1275450
Created October 10, 2011 14:25 — forked from javan/gist:1168475
Fix iPhone home button
Found this tip in comment here: http://www.tipb.com/2011/01/04/tipb-bug-home-button-working-iphone/
1.) Open any application
2.) Press and hold the power button until the slide to shutdown swipe bar appears.
3.) Release Power button
4.) Press and hold Home button Lightly
until screen returns to icon screen
@ecentinela
ecentinela / imagick
Created October 19, 2011 18:14
install imagick on mamp 2 - lion
# install brew
/usr/bin/ruby -e "$(curl -fsSL https://raw.github.com/gist/323731)"
# install imagemagick
brew install imagemagick
# install imagick
brew install imagick
# if giving errors on the installation, comment the content on ~/.bash_profile or ~/.profile, open a new terminal and retry
@ecentinela
ecentinela / gist:1299236
Created October 19, 2011 18:39
universal virtual hosts for apache
# place this code on http-vhost.conf file
UseCanonicalName Off
VirtualDocumentRoot /Users/MY_USER/Documents/%0/web
<Location />
AllowOverride All
Options +FollowSymLinks
</Location>