Fri Sep 30
“ The whole experience is a blur. An adrenaline-filled heart-attacky blur. ”
Hillary, describing what it’s like to ride The Zipper
Thu Sep 29
#rubyist.org
“ Nothing is less real than realism. ”
Georgia O’Keefe
Make default template assertions implicit
# Refactor your action and the template assertion # can remain unchanged. Tiny victories! def assert_default_template assert_template @controller.action_name assert_response :success end
Shopify previews Liquid
Jaded Pixel has been working on Shopify for some time now. It’s the same idea as Paul Graham’s Viaweb, ten years later. They’ve just given a preview of a simple yet seemingly powerful templating markup that they will be making available to their users.
<div class="product-image">
{{ product.image -> thumbnail }}
</div>
Don’t see functionality like that too often. I trust Tobi won’t let you do:
{{ customer.billing_info -> creditcard_number}}
Wed Sep 28
#rubyist.org
#rubyist.org
“ I hear the train a comin’. It’s rollin’ ’round the bend. ”
Johnny Cash, Folsom Prison Blues
Tue Sep 27
#rails-core
#rails-core
“ Basecamp is a Web 1.5 app. ”
Sam
Mon Sep 26
SchemaDumper
Ruby on Rails core developer Jamis Buck has a write-up on a new feature he’s implemented in ActiveRecord that lets you get a snapshot of your DB schema dumped into pure Ruby. (Jamis is a real workhorse by the way. Humility prevents him from telling you that himself. Just look at the Rails timeline sometime: He’s got his fingers all over it.)
#rubyist.org
“ You’re just full of false hope on this tumblelogging thing today. ”
Chad
“ Hudson is charming and yuppified and beautiful. ”
Henry the Intern
Sun Sep 25
Generate sorta-kinda-UUIDs in JavaScript with Prototype 1.4.0_pre6
function UUID() {
return [4, 2, 2, 2, 6].map(function(length) {
return $R(0, length, true).map(function() {
return (Math.random() * 256).toString(16);
}).join('');
}).join('-');
}
/* UUID()
* => "eea637ad-e840-dc78-8199-d1c176f3a170" */
Sat Sep 24
“ Her body has not truly been stripped til her clothes have been ripped by his nail bitten fingers. ”
The Librarian by Hefner
Tip Prevent accidental toggling of Safari’s popup blocker
It took me quite a while to realize that the reason Safari so frequently forgets its popup blocker setting is because I’m accidentally triggering its Cmd-K hotkey (either by mistyping Cmd-L to get into the address bar, or by not switching focus to Finder before using Cmd-K to mount a network share).
Here’s how to remap it to something else:
- Open System Preferences and click on the Keyboard & Mouse button.
- Click the Keyboard Shortcuts tab, then click the + button below the shortcut list.
- Choose “Safari” from the Application drop-down and enter “Block Pop-Up Windows” in the Menu Title field.
- Type a new key combination in the Keyboard Shortcut field. I’m using Shift+Cmd+K.
- Click Add, then restart Safari.
#rubyist.org
#rubyist.org
#rubyist.org
Fri Sep 23
#rubyist.org
#rails-core
Thu Sep 22
“ [I]t makes me sick just thinking about it. [N]o program should be that big (25,000 lines) - just like no soda should be 64 ounces. ”
Ara. T. Howard
Easily assert that records are correctly ordered in functional tests
def assert_ascending(collection) previous_value = yield collection.first assert(collection[1..-1].all? do |current| returning(previous_value <= (current_value = yield current)) do previous_value = current_value end end) end def assert_descending(collection, &block) assert_ascending collection.reverse, &block end # Test that @people is ordered by company name assert_ascending assigns(:people) do |person| person.company.name.downcase end
#rubyist.org
Tip Rake task dry-run
You can see what a Rake task would do without having it actually do it by passing in the -n option.
$ rake test_functional -n ** Invoke test_functional (first_time) ** Invoke test_environment (first_time) ** Execute (dry run) test_environment ** Invoke create_db (first_time) ** Invoke destroy_db (first_time) ** Invoke environment (first_time) ** Execute (dry run) environment ** Execute (dry run) destroy_db ** Execute (dry run) create_db ** Execute (dry run) test_functional
Wed Sep 21
#rails-core
GIANTmicrobes®
They make stuffed animals that look like tiny microbes. If you go down to the woods today, you’re in for a big surprise. Who knew ulcers were so cute?
“ My job went to Ionist… ”
Marcel
“ …and all I got was this lousy tumblelog. ”
Chad
#rails-core
Tue Sep 20
“ Matz has given the OK to start checking RubyGems into the Ruby trunk. ”
why the lucky stiff
DRY up object attribute change assertions
def assert_difference(object, method, difference=1) initial_value = object.send(method) yield assert_equal initial_value + difference, object.send(method) end def assert_no_difference(object, method, &block) assert_difference object, method, 0, &block end # ... def test_new_publication assert_difference(Publication, :count) do post :create, :publication => {...} # ... end end
Tumblelogs everywhere
Chris Wanstrath kindly informed us of his new tumblelog, ones zeros majors and minors, by email last night. It seems great, and we’re looking forward to the release of his ozimodo tumblelogging engine.
Make all associated records of an AR object spring into existence as instance variables
# ex.: If Client belongs_to :firm and :project, # vivify @client = Client.find(params[:id]) # gives you @firm and @project associations. def vivify(object, macros = [:belongs_to]) all_associations = object.class.reflect_on_all_associations all_associations.each do |association| next unless macros.include? association.macro instance_variable_set "@#{association.name}", object.send(association.name) end end
Mon Sep 19
“ The bearing of a child takes nine months, no matter how many women are assigned. ”
Frederick Brooks
Tip Rake tab completion for bash
[Courtesy of Nicholas Seckar] Tab complete your Rake tasks in bash with this script (508 bytes). Load it in your ~/.bashrc like this:
complete -C path/to/script -o default rake
Sun Sep 18
#rubyist.org
“ All programmers are optimists…Perhaps it is merely that computers are young, programmers are younger, and the young are always optimists. ”
Frederick Brooks
Sat Sep 17
“ Everything is both. ”
My 5 year old nephew
Fri Sep 16
“ We’re doing everything just right, except for touching and for holding and consoling. Let’s go bowling. ”
Lambchop , Let’s go bowling
“ I search for myself. ”
James Britt, out of context
David Hockney goes to the movies
Tons of pictures shot with a digital camera assembled together into a narrative that “reads” like a short movie. High quality and well done.
Thu Sep 15
Build a hash from two arrays
keys = [:a, :b, :c, :d] values = [:one, :two, :three, :four] Hash[*keys.zip(values).flatten] # => {:a=>:one, :d=>:four, :b=>:two, :c=>:three}
Wrap instance variables in accessors without exposing them
class Image [:name, :path].each do |sym| attr_reader sym private sym end def initialize(name, path) @name, @path = name, path end # ... end
What happens when t approaches 0?
Andy Hunt ponders the implications of rapid (and I mean rapid) application development.
“ There are a number of additional UI enhancements that you can take advantage of in the ASP.NET ‘Atlas’ framework. For example:”
- Coming soon
- Coming soon
Microsoft
Microsoft Atlas: Let the “embracing” begin
The new Atlas Ajax framework from Microsoft features a
$() function, lifted wholesale from Prototype where it debuted in March with Rails 0.10.
I couldn’t find mention of its origin anywhere on the Atlas site. Fancy that! The Atlas team should take a cue from David Flanagan, author of O’Reilly’s JavaScript: The Definitive Guide, who politely asked if he could include $() in the next edition of his book.
Update Thomas Fuchs has more on the Scriptaculous/Prototype ripoff.
#rails-core
Wed Sep 14
“ You will care far less what other people think of you when you realize how rarely they do. ”
David Foster Wallace [paraphrased]
C# 3.0 specification
Mixins, lambda syntax, implicit typing, named arguments for constructors, and a query expression language mean it’s not just a Java clone anymore.
Open source spirituality
_Just as open source software is continually being upgraded with new improvements or capacities, the open source spirituality process is also in a process of never ending upgrades. _
The Onion can only wish they’d come up with this first.
Sadly they have nothing to say about the new Agile Spirituality methodology. They need to Get Real.
Tue Sep 13
“ Starry Decisis…Starry Decisis…Starry Decisis…Super Starry Decisis…[etc…] ”
Arlen Specter
“ Here’s something to keep an eye on—tumblelogs … The best example (by far) is the gorgeous Projectionist website … a site that has forever changed the way I think about blogging. Amazing. ”
Thanks Marcus Vorwaller
Mon Sep 12
“ I only write two things by hand: math and love letters. ”
Zane Crawford
#rubyist.org
Sun Sep 11
“ Joel has fulfilled my vibration needs by driving on the rubble strip for extended periods of time. ”
Ruth, who is taking a road trip with Joel
Sat Sep 10
#ruby-lang
Fri Sep 9
“ We are still in the infancy of naming what is really happening on software development projects. The answer is not process, modeling, or mathematics, although those play parts. The answer has much more to do with craft, community, pride, and learning. ”
Alistair Cockburn in Agile Software Development
#rubyist.org
Is Rails ready for prime time?
Dave Thomas serves up a huge dose of pragmatism.
Choice excerpt:
[T]here are situations that call for the shock and awe that is J2EE
Racy ;)
Thu Sep 8
“ Since I have been sick of poorly managed issue tracking in Ruby development (my bad), finally I decided to move on to basecamp. ”
Matz
Wed Sep 7
Enumerable#inject_with_index
module Enumerable def inject_with_index(memo = nil) inject([-1, memo]) do |(i, m), v| next [i, v] if i == -1 unless m [i += 1, yield(m, v, i)] end.last end end
“ I am gen awesome. ”
Patrick Henry Ewing
Tue Sep 6
#rubyist.org
Mon Sep 5
Ajaxed Apple Store
So I’m checking out new PowerBook configurations, and what do you know? The Apple Store has been Ajaxed. Select an option and the price and configuration in the right-hand sidebar is updated, along with a blue-colored “yellow fade.”
Sun Sep 4
“ Software is at least as malleable as software requirements. ”
Chad Fowler, My Job Went to India
#rubyist.org
“ In other words, I think your katamari is pretty huge right now. ”
Patrick Henry Ewing
Sat Sep 3
Nudge, nudge
So we added comments to Projectionist. It took 0 lines of code, thanks to why the lucky stiff’s hoodwink.d. And it’s spam-free.
Feel free to steal our banner if your site is hoodwink’d too. And if you haven’t signed up yet, what are you waiting for?
Fri Sep 2
TextMate 1.1b17
A new beta of TextMate is out with enhanced (“intelligent”) snippets. Watch this video, then read the detailed explanation in his blog post and watch the video again. Odgaard truly is a perfectionist.
Selectors with CSS Builder
Have you been following Scott Barron’s progress on CSS Builder? He’s created a convenient, DRY DSL for describing selectors, which he plans to use as the basis for a set of macros which let you, say, hide a block of CSS from Internet Explorer.
Super cool stuff. (You can check much of it out now from the Builder CVS repository.)
Thu Sep 1
“ It’s not about where you sit on the perceived value chain of project work (where the architect holds the highest spot of royalty). It’s about how generally useful you make yourself. ”
Chad Fowler, My Job Went to India