In vim 7.0 try the following:
:tabnew http://www.google.com
:e # to reload
Very handy to quickly view source, or edit any remote HTML/CSS, etc.
In vim 7.0 try the following:
:tabnew http://www.google.com
:e # to reload
Very handy to quickly view source, or edit any remote HTML/CSS, etc.
One significant programming paradigm I first learned with perl, and have carried over to other programming languages such as ruby, is to think of arrays and hashes as fundamental data types, accompanied by their associated functions/methods. Though not as great of a leap as the transition from procedural to object-oriented programming; to be able to work and think fluidly, and write succinct code using arrays and hashes is an important programming skill to have. Once one develops this habit, to work in a language in which these methods are lacking feels similar to speaking in a foreign language that lacks words for the ideas you want to express. In programming, properly using these methods effectively translates into less lines of code and/or greater abstraction.
[Read more]
In addition to mapping out the Mandelbrot set, ruby’s inject method can also be used to easily find and/or create nested categories given a breadcrumb path.
Assuming Category is a Ruby on Rails ActiveRecord class that acts_as_tree, and breadcrumbs is an array of breadcrumb strings, e.g. breadcrumbs = [’Widgets’, ‘Green Widgets’, ‘14V Widgets’] :
The final “id && Category.find(id)” is to have the function return nil in case breadcrumbs is empty.
This returns the final Category object if it exists, and creates any or all components of the path as needed.
,
Recent Comments