Posts tagged with code

STFU

STFU

( via aaronland)

“It’s all coming from the gracious note of the ruby-debug gem.”

I always wonder why dhh doesn’t have a native english speaker proofread his posts.

I’m going to name my character “Scourger the CHANGELOGs” in my next D&D campaign.

Cheater Sneakers

Cheater Sneakers

I spent some time playing with the cross browser GUI/drawing framework Shoes today and to get my feet wet took up the _why’s mini-challenge to hook it up to Cheat Sheets.

It took about two hours– the majority of which was spent trying to figure out how to make use of the cheat gem. At the moment, rubygems aren’t wired into Shoes. Even unpacking that gem into a /lib directory in your Shoes app causes problems since cheat itself requires rubygems.

In the end, I opted to just grab and parse the cheats directly from the web myself, using open-uri and yaml (the cheat command line tool is powered by YAML files served from the website):

   YAML::load(open("http://cheat.errtheblog.com/ya/"))["All Cheat Sheets"]

The online documentation for Shoes is lacking, although there is a book you can order online. I’m certainly tempted to order the book, but for those who are just dabbling it would be nice if a better online primer existed. There are links to samples sprinkled throughout the wiki, but if you are looking for straight documentation of Shoes classes and methods you’ll have to go digging through the source.

If you have a bit of time, you should be able to play around and experiment without too much frustration. The only problem with Cheater Sneakers is that it doesn’t always immediately refresh the screen. Occasionally you need to resize the window for the background of a Stack to redraw of the text to update. It’s possible I’m doing something wrong, but I’m following the guide of most of the examples with use replace to update displayed text. Here is the code for updating the currently displayed cheat sheet: (note that @name is set via a list_box)

button "Go" do
   c = cheater.fetch(@name.text)
  @title.replace @name.text
  @info.replace( c[@name.text] )
end

The other downside is there is currently no easy way to package and distribute a Shoes application, which is why I don’t have it here for download (there are bundled images). The above screenshot will have to suffice until I figure out an easy way to pass it around.

That isn’t to say Shoes isn’t a nifty and much needed toolkit (or artkit?). On the contrary, it was quite a joy to play with– it was probably the quickest I’ve been able to build something with a an unknown GUI toolkit and fun as well. I’ve spent some time working with Processing before, and I think that Shoes seems more intuitive. I’m definitely looking forward to digging deeper into it.

Note: In real life the dropdown menu isn’t partially transparent. You can use your imagination though.

Skins Are Lame

I love this article, but it’s ironic that Mozilla’s use of XUL has actually turned out to be wildly useful in practice.