Browsing All Posts filed under »Ruby«

Using Gradient in HTML using simple CSS

August 12, 2011

0

In this post I show(after some googling) how to use gradients(color transitions) in your html using simple CSS. I am putting the CSS code below. This code can be pasted in the css file of your project. you have to create a div with id as “gradient”. Alternatively, you can paste this code in style […]

Some Core Rails Helper for Ruby

August 10, 2011

3

The Core Extensions are ActiveSupport’s collection of extensions to Ruby’s core classes and modules. They are basic design patterns solving problems that are encountered often in Ruby. These methods are one level below the Rails API; they are the internal functions that Rails uses. Class:Array–> ————————————————————————————————————————————- Conversions core_ext/array/conversions.rb • Array#to_sentence joins the array’s elements and […]

Programming Language

August 9, 2011

0

The primary purpose of source code should not be expressing implementation to a computer; it should be expressing meaning to people. Programming languages are an incredibly expressive and terse medium for the concepts programmers talk about. Proposals to make programming languages more English-like inevitably fail not because of poor implementation but because there is an […]

Ruby we might Miss

August 9, 2011

0

This is the continuation part of the series I started. The topic for this post : String —————————————————————————————————————— String#%(args) interpolates the arguments into itself in the manner of sprintf. To provide more than one value for interpolation, you must supply an array. “%.5f” % Math::PI # => “3.14159” “%.5f, %.5f” % [Math::PI, Math::E] # => […]

Ruby we might Miss

August 9, 2011

0

This is the continuation part of the series I started. The topic for this post : Proc —————————————————————————————————————— • Proc#[] is shorthand for Proc.call. p = lambda{|x| x * 2} p[3] # => 6 ——————————————————————————————————————

Ruby we might Miss

August 9, 2011

0

This is the continuation part of the series I started. The topic for this post : Module —————————————————————————————————————— • Module#remove_method removes a method from the specified class. Module#undef_method, on the other hand, actively prevents that method from being invoked on the class; it inserts a special entry into the m_tbl that stops method lookup. ——————————————————————————————————————

Ruby we might Miss

August 9, 2011

0

This is the continuation of the series I started. The topic for this post : Kernel —————————————————————————————————————— • Kernel#Array tries to coerce its argument into an array: Array([1,2,3]) # => [1, 2, 3] Array(1..3) # => [1, 2, 3] Array(1) # => [1] ——————————————————————————————————————