Tag Archives: Ruby

Finding a Website’s Favicon with Ruby

For a project I’ve been working on, I wanted to to have my Sidekiq worker (which is part of an RSS crawler) discover the favicon for a web site and cache it for later display. It was fun figuring out a way to do this, so I just had to share.

A Brief History of Favicons

Favicons, or “shortcut icons,” can be defined in multiple ways. Like all too many things in web design, browsers handle them in slightly different and mildly incompatible ways, meaning there’s plenty of redundancy. Favicons came to be when Microsoft added them to Internet Explorer 5 in 1999, implementing a feature where the browser would check the server for a file named favicon.ico and display it in certain parts of the UI. The following year, the W3C published a standard method for defining a favicon. Rather than simply having the browser look for a file in the root directory, an HTML document should specify a file in the header with a <link> tag, just like with stylesheets.

Continue reading →

Dashing — The Exceptionally Handsome Dashboard Framework

Need to throw together a quick dashboard with live-updated information and statistical readouts? Dashing is a fun new framework built atop Sinatra that lets you quickly setup dashboards, much in the style of Microsoft’s “Metro” UI. You can leverage premade widgets (which include numerical readouts, meters, graphs and lists) or make your own with HTML, SCSS, CoffeeScript and a bit of Ruby. Dashing uses Batman.js and rufus-scheduler to run server-side jobs at scheduled intervals and update the browser.

A live demo of Dashing can be seen here.

Dashing

I know I’m going to have a bit of fun setting up personal dashboards that pull in various fun statistics. There are already quite a few pre-made widgets out there, which should be helpful.

Try Ruby: A Clever Interactive Programming Tutorial

Teaching a newbie how to program is a difficult task, whether you’re writing a book, recording a screencast or teaching a class. Similarly, it’s a bit of a hassle for someone who is proficient with one or two languages to pick up a new one.

Try Ruby is a clever interactive tutorial that would work well for either scenario. It takes the form of an in-browser command line Ruby interpreter with a pane along the bottom that gives you instructions. It tells you to type in a command, and explains what exactly is going on.

Doesn’t that make you want to learn Ruby? I went through a few steps, from basic arithmetic to strings to arrays, and it was kind of fun. Having to type out everything as you go seems to reinforce your understanding of what you’re doing better than simply reading a book. And once you’ve got the language down, you should be able to move on to watching screencasts for the Rails framework. I may have to give Ruby a try sometime.