Hybrid OO/FP with Michael Feathers

April 28th, 2009 by James Carr

This is kind of last minute, but this week we’ve been lucky to have Michael Feathers (the author of Working Effectively with Legacy Code) at Carfax for training, and he’s agreed to give a talk on Thursday night (April 30th) on Hybrid Object Oriented / Functional Programming. The talk will be hosted at Carfax at 7:00 p.m.

Carfax’s Missouri Data Center is located at 2301 Maguire Blvd Columbia, MO … right off of Lemone. Feel free to tweet me at @jamescarr if you need help finding the place.


View Larger Map

Harness Twitter on the Client Side With jquery-twitter

April 14th, 2009 by James Carr

Recently I’ve been doing quite a bit of work with twitter’s searching api for an app I’ve been working on, and today I’m proud to announce that the jquery plugin I’ve written for it is now available on github as jquery-twitter for download.

Let me be frank, this isn’t something fancy like monitter or other similar tools that you can just smack on a website… rather, it’s a library that provide a javascript api to include twitter based stuff in your application.

Currently it supports much of the API, and all of the arguments each API call takes. Essentially, it all works if it doesn’t require authentication.

Searching

To do a simple search:

$.twitter.search('#followfriday', function(response){
	$(response.results).each(function(){
		$('body').append('

'+this.text+'

');
	});
});

You can also pass any of the search api parameters in as an optional second argument. Say I want to search for #followfriday in spanish, with 20 results per page:

$.twitter.search('#followfriday', {rpp:20, lang:'es'}, function(response){
	$(response.results).each(function(){
		$('body').append('

'+this.text+'

');
	});
});

The geocode parameters are setup in a little more structured feel. To search for terms 50 miles near 40.757929,-73.985506:

$.twitter.search('#followfriday', {geocode:{lat:40.757929, lon:-73.985506, radius:'50m'}}, function(response){
	$(response.results).each(function(){
		$('body').append('

'+this.text+'

');
	});
});

Alternatively, there’s a live search feature… it’s used just like the search method, however it researches twitter every 2 seconds and calls the callback with any new results since the last search.

$.twitter.liveSearch('#followfriday', {rpp:20, lang:'es'}, function(response){
	$(response.results).each(function(){
		$('body').append('

'+this.text+'

');
	});
});

The live search has a ton of features on it’s own, with special events that you can trigger or subscribe to, but I will cover that in more depth once the API around it becomes more solid.

Trends

Trends are pretty straightforward with three different methods for trends:

$.twitter.current(function(response){});
$.twitter.daily(function(response){});
$.twitter.weekly(function(response){});

User Timeline

Finally, you can get a user’s public timeline via

$.twitter.user_timeline('jamescarr', function(resp){
  $('body').append('

'+this.user.name+': '+this.text+'

');
});

That about wraps it up… this is a very fresh and will be constantly evolving as I improve it, so stay tuned for future improvements. ;)

jquery-text-tools: Link urls with jQuery

April 12th, 2009 by James Carr

Here’s a little something I threw together today that is simple, yet a bit useful too. I’ve been working on an application that consumes text from a JSON service on the client side and populates the page with the results, in real time. Some of the snippets of text have links in them, so I wanted something quick and easy to “linkify” any urls that are contained within the text. The result is this:

var linkifiedHtml = $.link("Go to http://www.google.com to search");

Which simply puts an anchor around the contained url. You can also use CSS selectors too… say you want to linkify every paragraph with the class foo:

$('p.foo').link();

That pretty much sums it up. Go grab it off github and feel free to fork it/add to it.

Pimp My GEdit

April 12th, 2009 by James Carr

I’ve been doing a lot of ruby on rails work lately, and in absence of TextMate on my linux laptop I was searching for something good to use. Eclipse with RadRails is okay, but sometimes it can be a heavy weight (and random long startup times and random “initializing java tooling” bogs me down). So I tried just revisiting my roots and using vim, which worked well enough, but felt uncomfortable in the whole dev cycle.

SO I searched the net and found an article on how to Pimp Gedit. Coupled with MultiTerminal, rails development has been a breeze.

Oh… and rspec and cucumber ran with autotest rocks!