Tuesday, October 11, 2011

CORS with Ext.js


Ext.Ajax.useDefaultXhrHeader = false
Ext.Ajax.request({url:'http://ipv4.0-9.fi', success: function(res,req){alert(res.responseText)}})

Saturday, September 10, 2011

Download a file from upload or file sonic with curl

Wupload:

curl -d "email=your@email.com&password=yourpassword&redirect=/file/159344782" -b cookies.txt -c cookies.txt www.wupload.com/account/login -L -o 20110910StokevsLiverpool1ertPachorriarte.mkv

Filesonic:

curl -d "email=your@email.com&password=yourpassword&redirect=/file/2820172905" -b cookies.txt -c cookies.txt www.filesonic.com/user/login -L -o somevideo.wmv

Wednesday, March 9, 2011

Valgrind on your ruby extension test

valgrind --num-callers=50 --error-limit=no --partial-loads-ok=yes --undef-value-errors=no rspec spec/extension_spec.rb

Tuesday, December 21, 2010

Monday, April 5, 2010

apr_poll timeout while running ab

If you get this error while running ab (ApacheBench) on your mac:

apr_poll: The timeout specified has expired (70007)

It may get fixed with:

sudo sysctl -w net.inet.ip.portrange.first=32768
sudo sysctl -w net.inet.tcp.msl=100

Friday, April 2, 2010

New Ruby gems

Oops! It's been a while since the last time I updated my blog.
I promise I'll try to get back to business and write more often whenever I find some time.

First of all, many months ago I joined Cubox, a new uruguayan startup that works for many US clients including partnership and offshore work with renowned Rails shops. We are continuously growing and we are always happy to add talented developers to our team so if you are interested and are passionate about Ruby, Rails and agile development just email us.

We believe in open source, we use it in all our projects and we also contribute to the community. Here is an update of my latest new gems which were not covered in this blog. I hope you find them useful, click on the links for more info:
  • Preforker: Easily create preforking servers (like Unicorn architecture)
  • Rankable Graph: Calculates the pagerank of medium sized graphs (some millions of nodes).
  • State Pattern: A classical implementation of the state pattern.
  • Active Record State Pattern: State pattern applied to Rails models.
  • Stubborn: Helps finding missing external API stubs in your tests.
  • Google Set: API for Google Sets.
  • Change Watcher: Helps keeping a log of changes. Useful to store scraped info from cron scripts.
So check them out and contribute!

Friday, May 22, 2009

Gem to send mails through Gmail

I made this little gem, gmail_sender that I find useful to log things when I'm running some script in my VPS, I use it for things like this:

require 'rubygems'
require 'gmail_sender'

g = GmailSender.new("gmail_account", "password")
begin
#Some interesting script that returns some interesting results in script_results
g.send("dcadenas@gmail.com", "It worked!", script_results.to_yaml)
rescue => e
g.send("dcadenas@gmail.com", "It didn't work :(", "#{e.message}\n#{e.backtrace}")
raise e
end


So all you need to pass to the send method is an email address, the subject and the email content.


Source code is here and you can install it with sudo gem install dcadenas-gmail_sender (remember to add github to your rubygems sources).