A couple of my Python colleagues tried to impress me today with Python's named slices feature. The way it works is like that:
 s = list('helloworld!')
  => ['h', 'e', 'l', 'l', 'o', 'w', 'o', 'r', 'l', 'd', '!']
WORLD = slice(5, 10)
 => ['w', 'o', 'r', 'l', 'd']
So you can have your own customized slicing mechanism that you can apply to any list. Which is kind of cool. That prompted me to demonstrate how we can do the same thing with Ruby. Luckily, in Ruby world we have blocks, procs and lambdas, the ultimate play-dough that allows us to stretch and flex in every direction.
​s = ['h', 'e', 'l', 'l', 'o', 'w', 'o', 'r', 'l', 'd', '!']
  => ['h', 'e', 'l', 'l', 'o', 'w', 'o', 'r', 'l', 'd', '!']
world = proc {|x | x.slice(5, 10)}
 => ["w", "o", "r", "l", "d", "!"]

​so we can do things like:

first = proc { |x| x.slice(0) }
=> "h"

or even things that we can't do with Python's named slicing, since it doesn't allow us to pass the receiver as an argument to the block (x in our case)

last = proc {|x| x.slice x.length-1, x.length}
last[%w(dog rabbit fox cat)]
=> ["cat"]


median = proc {|x| x.slice(x.length / 2) }
median[%w(dog rabbit cat)]
=> "rabbit"

and of course we're not just restricted to slicing arrays,

domain_extractor = proc { |x| x.gsub(/.+@([^.]+).+/, '\1') }
=> "bootstrap"

and since it's a proc,  we can use it with any method that accepts procs and blocks

email_list = ["fred@bootstrap.me.uk", "john@gmail.com", "mary@yahoo.co.uk"]
=> ["joe@bootstrap.co.uk", "john@gmail.com", "mary@yahoo.co.uk"]
=> ["bootstrap", "gmail", "yahoo"]

Proc objects can be wonderful for some quick , reusable functionality or for when defining a method would be too much, as well as for more serious uses such as callbacks. If you use them regularly, l'd love to know your use-cases and hints & tips!