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 […]
In: Uncategorized · Tagged with: arrays, collections, enumerations, Rails, Ruby
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.
In: Uncategorized · Tagged with: Shortcut, Textmate Trick
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. […]
In: Uncategorized · Tagged with: New Zealand, Web Development, Wellington
Ruby trick – Save a sort for later, Reuse a sort block
Sort multiple arrays with a single block/proc
In: Uncategorized · Tagged with: Block, Proc, Reuse, Ruby, Sort
Textmate Trick – Execute one liners inline inside Textmate
Execute ruby within Textmate and get the result back in textmate!
In: Uncategorized · Tagged with: execute ruby, Textmate Trick
Textmate Trick – Quick Ruby / Rails Hash Pointer / Hash Arrow
How to quickly insert a hash pointer in Textmate
In: Uncategorized · Tagged with: Quick Hash, Textmate, Tip, Trick
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?
In: Uncategorized · Tagged with: 24 hour cache, Facebook API, facebook connect, GET Request, RestServer
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 […]
In: Uncategorized · Tagged with: Cookies, Facebook Authenticate, facebook connect, MD5 Hash