Monthly Archives: March 2009

Free Graze box

Update: Use the code 8YFYB8ZD for your free graze box, it lasts until April 7th I think!

I got my second graze box yesterday:

Graze box

I had completely forgotten about it so it was a really nice surprise and the timing couldn’t have been better, it turned up at 11:00 and I was just starting to get hungry.

Get a free graze box

I also got an email with a voucher code to give out. Just go to graze.com and enter T3RXJWYH into the relevant section and you will get your first box free and your second half price. Delivery is free too and there’s no obligation to get any boxes after the first one to it won’t cost you a thing to try it out. The offer is valid until April 1st (and no, it’s not a joke) so if you’ve missed it you can always use 1925CTC as the voucher code, this one has no expiry and will get you your first box for £1.

Ongoing

I’m not sure how long I am going to keep up the boxes after my offer period ends, it’s 50/50. The full-price boxes are a little too pricey for comfort (I get the olives that are 50 pence extra). They are nice though!

Tagged ,

Announcement: NWRUG March 2009 – Search in your App

The next NWRUG is tomorrow evening, 18:30 at the BBC in Manchester. Email me if you want to attend (details on the NWRUG page).

Rewriting URL params in nginx

I came across this problem recently, a customer was moving to Ruby on Rails from another framework/language (.NET I think) and needed to re-write a bunch of URLs. Some needed the query parameters rewriting too. One example was rewriting the old search path, so the old URL:

http://somedomain.com/OldSearchPath.aspx?qry=things&page=4

would become:

http://somedomain.com/search?query=things&page=4

This should be fairly simple except for the qry parameter needed to be changed to query. A bit of googling didn’t turn up much but with some experimentation I came up with this using the pre-populated nginx $args variable:

location /OldSearchPath.aspx {
  if ($args ~* qry=(.+)) {
    set $args query=$1;
  }
}
rewrite ^.+$ /search redirect;

It even leaves the other parameters intact, so the pagination will still work.

Tagged ,
Follow

Get every new post delivered to your Inbox.