Wetware » 2009 » March

Archive for March, 2009

Ruby on Rails – Easier enumerations (Select, Collect, Map) using Ampersand

a = [] # setup array 0.upto(100) do #just make up some array a << rand(1000) end s = a.in_groups_of(6,false) # make it an array of arrays (so we can use the sort method on each element of the outer array) s.collect(&:sort) #sort each array inside the outer array in one easy step What are […]

Posted on March 31, 2009 at 10:31 am by Jordan Carter · Permalink · One Comment
In: Uncategorized · Tagged with: , , , ,

Textmate Trick – quickly jump to function / method definition in file

To quickly jump to where a function or method is defined in your ruby file Shift + Apple/Command + T I say Apple/Command because people call that key by either of those names.

Posted on March 30, 2009 at 4:40 pm by Jordan Carter · Permalink · One Comment
In: Uncategorized · Tagged with: ,

What do I do? I live in New Zealand baby!

I work for Made From New Zealand and you can see my profile Jordan Daniel Carter over there too.  The website’s purpose is to promote New Zealand to the world through all digital means we have access to. We have a great team of people using the latest and greatest tools to get us there.  […]

Posted on March 30, 2009 at 11:20 am by Jordan Carter · Permalink · Leave a comment
In: Uncategorized · Tagged with: , ,

Ruby trick – Save a sort for later, Reuse a sort block

Sort multiple arrays with a single block/proc

Posted on March 29, 2009 at 12:09 pm by Jordan Carter · Permalink · Leave a comment
In: Uncategorized · Tagged with: , , , ,

Textmate Trick – Execute one liners inline inside Textmate

Execute ruby within Textmate and get the result back in textmate!

Posted on March 28, 2009 at 11:40 am by Jordan Carter · Permalink · Leave a comment
In: Uncategorized · Tagged with: ,

Textmate Trick – Quick Ruby / Rails Hash Pointer / Hash Arrow

How to quickly insert a hash pointer in Textmate

Posted on March 27, 2009 at 11:26 am by Jordan Carter · Permalink · Leave a comment
In: Uncategorized · Tagged with: , , ,

How do I use Facebook’s restserver.php?

Facebook’s API is crap.  I am integrating Facebook Connect into our website and I have struggled to no end on working out how to do it!  So as per usual as soon as I work something new out I post it here. So, you want to use Facebook’s API restserver?

Posted on March 24, 2009 at 10:06 am by Jordan Carter · Permalink · 5 Comments
In: Uncategorized · Tagged with: , , , ,

Authenticate Facebook Connect User

Check Facebook Connect Cookies (example below) 2c24418bf8fe35ce3e56bdb81510147e_expires = 1237932000 2c24418bf8fe35ce3e56bdb81510147e_session_key = 3.giQwAnobPPDTc84_y7zuug__.86400.1237932000-705926010 2c24418bf8fe35ce3e56bdb81510147e_ss = x0mM2T_o9B3YG7TfhLGoQQ__ 2c24418bf8fe35ce3e56bdb81510147e_user = 7059246010 2c24418bf8fe35ce3e56bdb81510147e = 6aba0f0fc1f6c3fc0f2f477e9b0b0f93 Remove APP_ID from front of all FB cookies Store FB user_id, session_key and Expected MD5 Hash.  MD5 Hash is the cookie without the extra stuff after the APP_ID (Last in list above) Strip APP_ID […]

Posted on March 24, 2009 at 9:48 am by Jordan Carter · Permalink · One Comment
In: Uncategorized · Tagged with: , , ,