2 days ago
Early this morning, the first commercial manned space craft docked with the International Space Station, 230 miles above the Earth’s surface. As if this wasn’t awesome enough, you could watch this event live, from anywhere in the world, on your phone.
5 days ago
The Dot is Optional
My favorite podcast recording yet.
Jonathan and Kelli talk about accessing REST APIs over SMS, wrestling with Google Chat bots, confusion about the HTML5 Audio tag, and so much more.
5 days ago
Experimenting with the Architecture of Ember.js
Since I’m feeling too overworked at the moment to write my own blog post, I’ll link to one written recently by my very good friend, wherein he re-engineers the architecture of Ember.js to add a couple more degrees of separation.
It’s not for everyone, as he admits, but personally, I really like the idea of separation on the client side between UI interactions and application state (separate from the data model itself).
In some ways, it feels logically very similar to some of the ideas I’ve been working on lately with regards to server-side setups for scaling Sinatra applications…. but that’s a whole other blog post in and of itself, which I’ll go into at some point.
5 days ago
Run.
1 week ago
GTalk and Ruby
Yesterday I had the need to create a small GTalk bot in Ruby. I started looking around and, to be honest, it was really hard to find any examples newer than 2009 or so. Even the gems are old.
Sure, maybe the XMPP protocol hasn’t changed that much over the years, but Ruby has, so I thought I would make a quick note about how I finally got this working.
XMPP4R-Simple won’t work in Ruby 1.9.x (and I didn’t have time to debug it)
The Easy-GTalk-Bot gem is a very simple wrapper for XMPP4R and it worked fine for the most basic of bots, but it couldn’t handle the asynchronous nature of what I was building. The multi-threading would break down and the connection would drop.
Blather looked promising, but also seemed like overkill for what I needed and connection handling just looked like too much work (not really difficult, but overly involved for what should be necessary in this particular instance).
The gem you’ll want to use is just the plain and simple XMPP4R.
Here’s the basics to get you started. The below script will authenticate to GTalk, automatically accept any incoming “add contact” requests, and echo received messages back to the user. — Totally useless, but functional.
# gtalk.rb
require 'rubygems' require 'xmpp4r' require 'xmpp4r/roster' @username = 'you@gmail.com' @password = 'seekrit' @jid = JID::new(@username) @client = Client.new(@jid) @client.connect @client.auth(@password) @client.send(Presence.new.set_type(:available)) def roster @roster ||= Roster::Helper.new(@client) end roster.add_subscription_request_callback do |_, presence| inviter = JID::new(presence.from) roster.accept_subscription(inviter) invite(JID::new(inviter)) end @jabber_client.add_message_callback do |message| unless message.body.nil? # do stuff.... text = "You said '#{message.body}'" response = Message::new(JID::new(message.from), text) @client.send(response) end end Thread.stop
And here’s how you daemonize it with the Daemons gem.
# im.rb
require 'rubygems' require 'daemons' Daemons.run('gtalk.rb', { :app_name => 'myIMBot', :monitor => true, :log_output => false } )
You can now run the script with ruby im.rb start, ruby im.rb restart, and ruby im.rb stop. If you want to save error output, just enable logging. As an added bonus, Monit will now watch the script and restart it if it crashes.
2 weeks ago
The Making of Octicons
A nice little write-up of the workflow and process of creating Github’s new icon font.
3 weeks ago
Shakespeare in the original pronunciation.
3 weeks ago
MIT and Harvard Announce edX
This is ridiculously exciting. I feel like we’re only a few years from seeing a major shift in higher education.
1 month ago
9x12in Marker
1 month ago
File API Upload Image Preview - Now a jQuery Plug-in
I took last night’s script and turned it into a jQuery plug-in. Enjoy. :)
Page 1 of 6