Skip to content

Instantly share code, notes, and snippets.

@javiervidal
javiervidal / report_abuse.rb
Created December 18, 2009 11:28
Script to make post requests
require 'rubygems'
require 'activesupport'
require 'net/http'
path = "/report_abuse"
params = {"abuse"=>{"title"=>"momo", "resource_type"=>"Post", "resource_id"=>"15", "referer"=>"/conversatio/blogs/8-blog-de-nurse1/posts/15-el-cua
derno-de-notas-del-capitn-de-la-copa-davis-albert-costa", "description"=>"momo"}}.to_param
http = Net::HTTP.new("localhost", 3000)
http.post(path, params)
@javiervidal
javiervidal / gist:350225
Created March 31, 2010 11:53
One-liner to recursively replace <br> with <br/>
for f in `ack -l '<br>' app`; do sed -i.bak -e 's/<br>/<br\/>/g' $f; done
# ack -l '<(br|BR)\s*>' app
@javiervidal
javiervidal / w3c_validate.rb
Created March 31, 2010 14:50
Validate local HTML file
require 'rubygems'
require 'w3c_validators'
include W3CValidators
@validator = MarkupValidator.new
# override the DOCTYPE
#@validator.set_doctype!(:html32)
@javiervidal
javiervidal / basic_rack_app.rb
Created April 6, 2010 15:33
basic rack app
class LightningTalk
def initialize(app)
@app = app
end
def call(env)
# request
@javiervidal
javiervidal / records_in_each_table.sql
Created August 3, 2010 06:56
records in each table
SELECT table_name, table_rows
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA = '**YOUR SCHEMA**';
@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 )
@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 "fguillen.mail+spam@gmail.com"

Repository git user

cd /develop/myrepo

@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 / tunnel
Created February 11, 2011 09:57
tunnel
ssh -L local_port:destination_host:destination_port -l username middle_host
@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.