Skip to content

Instantly share code, notes, and snippets.

Twitter = Views: {}
class Twitter.Model extends Backbone.Model
class Twitter.Collection extends Backbone.Collection
url: 'http://search.twitter.com/search.json?rpp=10&q=phpfog&callback=?'
model: Twitter.Model
parse: (response) -> response.results
class Twitter.Views.index extends Backbone.View
$.fn.autolink = ->
regexps =
'<a href="$1">$1</a>' : /(https?:\/\/[\w?=&.\/-;#~%-]+(?![\w\s?&.\/;#~%"=-]*>))/g
'<a href="http://twitter.com/user/$1">@$1</a>' : /@([\w\d_]+)/g
@.each ->
for template, regexp of regexps
$(@).html( $(@).html().replace(regexp,template) )
.row .box {
border: 3px solid #454a55;
float: left;
font: 12px "Lucida Grande", "Lucida Sans Unicode", sans-serif;
height: 300px;
margin: 10px;
overflow: hidden;
padding: 20px;
width: 410px;
$.fn.subnavTabs = function(options) {
var opts = $.extend({}, $.fn.subnavTabs.defaults, options);
return this.each(function() {
var self = $(this),
items = self.children('li'),
links = items.children('a')
tabs = $(opts['target']),
show_active = function() {
tabs.children('div.box').hide();
$.fn.subnavTabs = function(options) {
var opts = $.extend({}, $.fn.subnavTabs.defaults, options);
return this.each(function() {
var self = $(this),
tabs = $(self.attr('rel')),
items = self.children('li'),
links = items.children('a')
show_active = function() {
tabs.children('div.box').hide();
$.fn.subnavTabs = function(options) {
var opts = $.extend({}, $.fn.subnavTabs.defaults, options);
return this.each(function() {
var self = $(this),
items = self.children('li'),
links = items.children('a')
tabs = $(self.attr('rel')),
show_active = function() {
tabs.children('div.box').hide();
def timesince(d, now=Time.now)
delta = (now - d).to_i
return "0 minutes" if delta <= 60
chunks = [
[60 * 60 * 24 * 356 , 'year' ],
[60 * 60 * 24 * 7 , 'week' ],
[60 * 60 * 24 , 'day' ],
[60 * 60 , 'hour' ],
[60 , 'minute' ]
12:40:20 [Users #skynet]
12:40:20 >>> krizzz ReinH
12:40:20 Irssi: #skynet: Total of 2 nicks [0 ops, 0 halfops, 0 voices, 2 normal]
12:40:20 >>> This Channel was created on Thu Jan 21 06:37:33 2010
12:40:20 Irssi: >>> Join to #skynet was synced in 0 secs
12:40:45 < ReinH> krizzz: you bastard, you've killed us all
class PluginBase
def self.inherited(subclass)
Notebot.irc.register_plugin(subclass)
end
end
module AdminUtilities
class Author < PluginBase
# ...
end
#!/usr/bin/env sh
#
# Output the difference between a facter command run on two different versions
# of facter. Uses unified diff format.
OPTIONS_SPEC="\
facter-diff [options] <rev1> <rev2> [fact]...
Example: