(function($){
 $.truncate = function(text, limit) {
  if (text.length > limit) {
    text = text.substr(0, limit - 4) + " ..."
  }
  return text
 }
})(jQuery);

(function($){
  $.nano = function(template, data){
    return template.replace(/\{([\w\.]*)}/g, function(str, key){
      var keys = key.split("."), value = data[keys.shift()]
      $.each(keys, function(){ value = value[this] })
      return value
    })
  }
})(jQuery);

(function($){
  // modified from TwitterGitter by David Walsh (davidwalsh.name)
  // courtesy of Jeremy Parrish (rrish.org)
  $.linkify = function(text) {
    return text
      .replace(/(https?:\/\/[\w\-:;?&=+.%#\/]+)/gi, '<a href="$1">$1</a>')
      .replace(/(^|\W)@(\w+)/g, '$1<a href="http://twitter.com/$2">@$2</a>')
      .replace(/(^|\W)#(\w+)/g, '$1#<a href="http://search.twitter.com/search?q=%23$2">$2</a>')
  }
})(jQuery);
