Category archive: work

November 17, 2007

the office 0

office

One of the nice things about not living in LA is that we actually have some room. This is where I spend a pretty huge chunk of my day and it makes life a lot better.

February 26, 2007

Snap Preview Anywhere contest 0

I’ve spent the past couple of weeks at work building a web application for Snap’s latest contest and it just went live at contest.snap.com. It allows users to submit ideas (for new features for a product) and lets them do some simple Digg-style voting.

The concept is very similar to the last Snap contest but it’s now a standalone web application (instead of a half dozen hacky Wordpress plugins). The site is actually a heavily-modified version of my message board software that runs omgtru.com.

June 21, 2006

For the past couple months at work I’ve been using Watir, a Ruby library for controlling Internet Explorer, to automate some of the testing on our site. But the Snap site is a beast, with an enormous amount of Javascript and hundreds of dynamically-modified divs.

Since Watir can bog down while iterating through 100+ div objects, I’m working directly with WIN32OLE objects for certain things.

I’m very new to ruby. And WIN32OLE is weird. I had just been copying code from the watir library and modifying it to suit my needs, but today I had to do some more complicated stuff. In ruby, you can view the available methods of any object by doing this:

puts foo.methods

But if you do that with a WIN32OLE object it doesn’t give you jack. I finally managed to find a ruby-talk post from 3 years ago that shed some light on this. So here’s a method that can pull it off:

class WIN32OLE
  def list_ole_methods
    method_names = ole_methods.collect {|m| m.name}
    puts method_names.sort.uniq
  end
end

So doing:

foo.list_ole_methods

Will give you a long list of method names you can call with your object.

I realize this isn’t, uh, interesting, but hopefully the next tard trying to figure this stuff out will be able to find this post on Google.

And just for the record, Watir fucking rules. It easily outperformed every other automation tool we evaluated (many of which cost tens of thousands of dollars) and, not coincidentally, harnesses the power of an awesome language like Ruby. A lot of the other packages we looked at use strange proprietary languages that aren’t really documented (because then they can talk you into taking a weeklong $8k training course) and can’t pull off half the stuff we’ve already done using Watir.

May 18, 2006

Snap blog launches 10

The Snap blog has launched and pretty much all hell has broken loose. Anyone who signs up can post to the blog with their “launch idea” and it will automatically get posted on the front page. Then other users can vote on the best ideas, and the winner gets $5,000. How could THAT go wrong?

I wrote several plugins for the blog, and it seems like the company is excited about releasing them to the public. This is pretty much the first significant stuff I’ve done with PHP and I really got to dig around in the guts of Wordpress to add some cool features:

Simple Vote
Adds a Digg-style vote box to posts from a certain category. Only registered users can vote.

Simple Post
Allows any user to post to the blog from a watered down interface, regardless of their privileges. Crazy, right? This way we can let users post to the blog without giving them access to anything in the admin interface.

Easy Author Info
Easily grab any author’s information. For example, you could print out any author’s “About me” text like this:

echo get_easyauthor_attr($author_id, "description");

These scripts need to be cleaned up and made more configurable before they can be released, but hopefully that should be pretty soon.