Posted on March 6, 2010, 12:13 pm, by David, under
L33t Links.
Running a website costs money which is why I’ve added some slots for Google AdSense ads on this blog and in its feed, namely at the bottom of every blog post, near the top of the sidebar on every page, and at the bottom of each feed item. They’re fairly small and colored similarly to the rest of the blog to make them as discrete as possible. Thanks for your understanding!
- Tilt, “Generic interface to multiple Ruby template engines”
- Frank, “Frank lets you build static sites using your favorite libs, painlessly”
- Rails 3: Let ActiveRecord Manage Your Translations
- Testing Facebook
- Jasmine for JavaScript Testing: It’s Screw.Unit++
- Put your mailer where the action is!, no, by “action” he does not necessarily mean controller action
- Ambitious Query Indexer, “Pain-free indexing to speed up your Rails app”
- Rapid prototyping with HAML, SASS and Ruby
- BlueGreenDeployment, clever
- Getting Real about NoSQL and the SQL-Isn’t-Scalable Lie
- validates_timeliness, “Date and time validation plugin for Rails 2.x and allows custom date/time formats”
- Breakneck, simple gem for serving static files on your development machine
- Performance Tuning for Phusion Passenger
- A quick RVM rundown
- 47 Amazing CSS3 Animation Demos
- SEOChecker, “check your website if it is seo”
- Jasmine, “DOM-less simple JavaScript testing framework” from Pivotal Labs
- The Ruby Standard Wiki, online version of the Ruby ISO standard draft
- #gemsday, “Share your favorite new RubyGems weekly”
- Rubex, “A simple copy cat of Rubular” – the real version has supposedly been acting up lately
- Write Fewer Regular Expressions, yay
- lambda { foo }.should run_in(1.second), useful RSpec matcher from Ryan Bigg
Tags:
activerecord,
bdd,
css,
css3,
database,
deployment,
email,
haml,
internationalization,
javascript,
nosql,
performance,
plugin,
rails,
rails3,
rspec,
ruby,
rubygems,
rvm,
sass,
scalability,
server,
sql,
tdd,
testing,
webdesign,
webdevelopment,
webserver No Comments |
Read the rest of this entry »
Posted on February 10, 2010, 8:32 am, by David, under
L33t Links.
- Bye Bye Github, the recent outages have consequences
- The Initialization Guide, 10.000 words – Ryan Bigg needs your help to find mistakes in the guide
- Give Back to Open Source, a challenge Ryan Bates gives everyone in his 200th episode of Railscasts
- 52framework, the first framework to combine the powers of HTML5 and CSS3!
- D’Note, “will scan your source code for labeled comments, collect, collate and sort them, and then return them to you in a format of your choosing”
- Rake tasks to get database and table sizes, by Mike Gunderloy and Elad Meidar
- The Building Blocks of Ruby
- Rails 3 Routing with Rack
- Scope a variable to a block in your template code, from which I learned something new today
- ‘What’s New in Edge Rails’ Moves to EdgeRails.info
- Using Bundler in Real Life, which de-mystified Bundler for me
- Plugin Authors: Toward a Better Future
- Haml Sucks for Content, luckily it isn’t trying to be good at it
- sinatra_more, “Generators, helpers and extensions enabling complex sinatra apps”
- MongoDB is fast, surprised? No? How much faster, then?
- Memory leak patterns in JavaScript
- Javascript Objects – A Useful Example
- Why ruby? part three – method arguments
- toto, “the 10 second blog-engine for hackers”
- Customizing Generators in Rails 3, useful
Tags:
bundler,
css3,
git,
github,
haml,
html,
html5,
javascript,
mongo,
open-source,
performance,
plugin,
rack,
rails,
rails3,
rake,
ruby,
rubygems,
webdevelopment No Comments |
Read the rest of this entry »
Posted on February 6, 2010, 2:30 pm, by David, under
L33t Links.
The first beta of Rails 3 is out! These links are all related to the release:
Un-related to the release:
Tags:
bundler,
git,
github,
javascript,
jquery,
plugin,
rails,
rails3,
ruby,
rubygems,
scm No Comments |
Read the rest of this entry »
Posted on December 3, 2009, 8:16 am, by David, under
L33t Links.
It’s been a while, but finally I can present a new bunch of links to you:
Posted on November 18, 2009, 10:48 am, by David, under
L33t Links.
Posted on November 12, 2009, 9:42 am, by David, under
L33t Links.
Posted on November 7, 2009, 7:43 pm, by David, under
L33t Links.
#42! This blog post is the answer to everything! Or not!
Posted on September 23, 2009, 9:16 am, by David, under
Projects.
This is really old news but I’m aiming to have one post per open source project on this blog.
Virtual Attribute Cache is the ultimate way to cache Active Record virtual attributes. The idea is simple. Say, for example, you have a first_name and a last_name column. Then you might have a full_name virtual attribute that joins first_name and last_name plus a full_name column in your database which stores the cached value of the full_name virtual attribute. With va_cache that would be accomplished like this:
class Person < ActiveRecord::Base
cached_virtual_attribute(:full_name, :expire_if => Proc.new { |p| p.first_name_changed? || p.last_name_changed? }) do
[first_name, last_name].join(' ')
end
end
Basically, you need to provide va_cache with three things:
- The name of the virtual attribute to cache.
- When to expire the cache (the
Proc will be evaluated in a before_save callback.)
- How to calculate the value of the virtual attribute.
If you don’t like to have Proc’s in the middle of your method calls you can use this alternative syntax:
class Person < ActiveRecord::Base
cached_virtual_attribute :full_name, :expire_if => :first_name_or_last_name_changed do
[first_name, last_name].join(' ')
end
def first_name_or_last_name_changed?
first_name_changed? || last_name_changed?
end
end
Final notes:
- Don’t use
va_cache with simple stuff like full names, obviously.
- If you pass a symbol to the
:expire_if a question mark will be appended automatically.
- Seriously, go look at the source code. It’s extremely simple.
That’s it. Enjoy!