Skip to content

Instantly share code, notes, and snippets.

View javiervidal's full-sized avatar

Javier Vidal javiervidal

View GitHub Profile
@javiervidal
javiervidal / gist:5748246
Created June 10, 2013 12:02
PS1 with git branch
export PS1='\[\033[0;36m\][\h] \[\033[0;35m\]\u\[\033[0;33m\] \w\[\033[0;00m\] \[\033[0;37m\]$(__git_ps1 "(%s)")\[\033[0;00m\] $ '
@javiervidal
javiervidal / canvasToFile.js
Created October 15, 2012 16:35 — forked from eamodeorubio/canvasToFile.js
Quick hack to save the contents of a canvas to a file in Windows 8 with JS
function saveToFile() {
var canvasData = document.getElementById('sampleCanvas').msToBlob();
var windowsStorage = Windows.Storage;
var inputStream, outputStream;
windowsStorage.KnownFolders.picturesLibrary.createFileAsync('sample.png', windowsStorage.CreationCollisionOption.replaceExisting)
.then(function (file) {
return file.openAsync(windowsStorage.FileAccessMode.readWrite);
}).then(function (out) {
inputStream = canvasData.msDetachStream();
canvasData.msClose();
@javiervidal
javiervidal / gist:3871062
Created October 11, 2012 08:47
vi cheatsheet
INSERTING TEXT
ESC command mode
i Insert before cursor
I Insert before line
a Append after cursor
A Append after line
o Open blank line below the cursor
O Open blank line above the cursor
@javiervidal
javiervidal / gist:2627262
Created May 7, 2012 11:04
Find and renaming files
find . -name "*.first" -exec rename -v 's/\.first$/\.second/' {} +
@javiervidal
javiervidal / gist:1433880
Created December 5, 2011 15:05
To access url helpers (url_for, etc) from Rails console (Rails 3)
include Rails.application.routes.url_helpers
default_url_options[:host] = "localhost"
@javiervidal
javiervidal / gist:1037681
Created June 21, 2011 11:42
firefox & AEAT
En Mozilla 1.7 y Firefox 2.0 o posteriores es necesario activar la preferencia: signed.applets.codebase_principal_support. Para ello, introducir about:config en el campo de entrada de la URL y pulsar Enter. Se obtendrá una lista de las preferencias. Buscar la preferencia anterior, realizar doble-click sobre ella y cambiar su valor de false a true.
@javiervidal
javiervidal / tunnel
Created February 11, 2011 09:57
tunnel
ssh -L local_port:destination_host:destination_port -l username middle_host
@javiervidal
javiervidal / install_ruby_1.8.6_rvm.txt
Created February 8, 2011 06:12
install_ruby_1.8.6_rvm
CFLAGS='-g -O0 -DRUBY_EXPORT -D_GNU_SOURCE=1' rvm install ruby-1.8.6-p287 --with-openssl-dir=/home/jvp/src/openssl-0.9.8c
@javiervidal
javiervidal / git_tips.md
Created December 20, 2010 10:40 — forked from fguillen/git_tips.md
Git tips

(Several of these git examples have been extracted from the book 'Pragmatic guide to GIT' of Travis Swicegood )

Git tips

Global git user

git config --global user.name "Fernando Guillen"
git config --global user.email "[email protected]"

Repository git user

cd /develop/myrepo

@javiervidal
javiervidal / rvm_install_ubuntu.sh
Created November 30, 2010 12:06
rvm install ubuntu
sudo apt-get install build-essential
sudo apt-get install curl
sudo apt-get install zlib1g-dev libreadline5-dev libssl-dev libxml2-dev
sudo apt-get install ruby1.8 rubygems1.8
bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )