Jay McGavren's Journal

2008-10-10

ActiveSupport, only when you need it...

I’m betting Rails enthusiasts would like to have access to ActiveSupport core extensions all the time, even when working in regular Ruby. But on my box, “require ‘activesupport’” incurs a 6-10 second delay, so I don’t really want to load it every time I bring up irb.

So I’m putting this in my Utility package:

module DeferredActiveSupport
	def method_missing(method, *arguments, &block)
		require 'activesupport'
		if self.respond_to?(method)
			self.send(method, *arguments, &block)
		else
			raise NoMethodError.new("#{method} not defined")
		end
	end
end

class String
	include DeferredActiveSupport
end

class Object
	include DeferredActiveSupport
end

#Other classes as desired...

Which lets me do this:

puts ({:foo => 'bar', :baz => 'glarch'}).to_json
puts 'foo'.titleize
puts 'test'.pluralize
puts 'large_pepperoni_pizza'.camelize

Yielding:

{"foo": "bar", "baz": "glarch"}
Foo
tests
LargePepperoniPizza

Read more...
2008-10-08

Was Googling a bit to see if anyone else had ever considered naming their computer “Chiark Hub” (answer: 2 people have). I came across a quote I’d read before, but not realized the relevance of:

"In all the human societies we have ever reviewed, in every age and in every state, there has seldom if ever been a shortage of eager young males prepared to kill and die to preserve the security, comfort and prejudices of their elders, and what you call heroism is just an expression of this fact; there is never a scarcity of idiots." --Iain M. Banks, Use of Weapons

Read more...
2008-10-07

Passed on by Jeremy:

You answer the following 12 questions about yourself.

1. What is your first name?
2. What is your favorite food?
3. What high school did you attend?
4. What is your favorite color?
5. Your celebrity crush?
6. Favorite drink?
7. Dream vacation?
8. Favorite dessert?
9. What do you want to be when you grow up?
10. What do you love most in life?
11. One word to describe you?
12. Your Flickr name?

Type your answer to each of the above questions into Flickr's search. Using only the images that appear on the first page, choose your favorite and copy and paste each of the URLs into the Mosaic Maker (3 columns, 4 rows).

mosaic149602.jpg

  1. Bill Gates and Jay Z, 2. Sweet & Sour Pork, 3. Brendan Benson at the Southgate House, 4. green & blue, 5. Halle Berry, 6. Pepsi Billboard on Hudson River (Manhattan), 7. Kalalau Lookout - Kauai, Hawaii, 8. Hersheys Chocolate Cake 2, 9. DataArt Software Outsourcing Developer (fun), 10. Wife, listen to me!, 11. Energetic, 12. Gamer

Read more...
2008-10-07

Arrrggghhh… I want an Android phone, or an iPod with Wi-Fi, or something where I can rate songs while I drive and then sync ratings at home. Jotting myself is definitely not the most efficient way…

Reminder, rate Brent Dennen Desert Sunrise at five stars. Reminder Ritz. I am in wine(?) sunset seems forgotten. I have five stars Reminder. Ray(?), Iron and wine each coming night at Tarsars(?). Computer reminder, rate tab pure essence this feeling at Five Stars. Computer reminder. Rate(?) Kuresons(?) standing in your shadow at fire(?) for surs(?). Reminder, Ray(?) Pereason(?) is walking data(?) five(?) size(?). Reminder, rate Ray Hare coming again at four starts. Reminder research the [broken audio], computer reminder rate the blues tones, the fountain head at five stars. Computer reminder. Re-quantic(?) lighter than the sky at four stars. Computer reminder, rate quantic sweet calling at 4 thirds. Grand(?) ____ nine(?) lazy nine grazing maze at four stars(?). [unclear speech, please listen] Computer reminder, rate(?) 9(?) laser(?) 9(?) coarser(?) at 4(?) size(?).

Read more...
2008-10-06

In praise of dogfooding...

Historically, languages designed for other people to use have been bad: Cobol, PL/I, Pascal, Ada, C++. The good languages have been those that were designed for their own creators: C, Perl, Smalltalk, Lisp.

–Paul Graham

Read more...