This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'open-uri' | |
require 'json' | |
url = 'http://twitter.com/statuses/user_timeline.json?id=visnup&count=3200' | |
dates = open(url) { |f| JSON.parse f.read }.map { |e| Date.parse e['created_at'] } | |
sum = dates.inject(Hash.new(0)) { |s, t| s[t] += 1; s } | |
sum.keys.sort.each { |k| puts "#{k} (#{sum[k]}) #{'=' * sum[k]}" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'activesupport' | |
class String | |
def emphasize substrings | |
highlight self, substrings | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Detect rss feed, parse it, and report number of posts per date. | |
require 'rubygems' | |
require 'hpricot' | |
require 'open-uri' | |
# First find the rss | |
url = ARGV[0] || "http://twitter.com/burnto" | |
doc = Hpricot(open(url)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Configure your desired options here | |
DESIRED_HOSTNAME="lazeroids.com" | |
# Ensure hostname is configured | |
if [ -z "$DESIRED_HOSTNAME" ]; then | |
echo DESIRED_HOSTNAME must be set. | |
exit 1 | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem 'cramp' | |
gem 'erubis', '2.6.5' | |
gem 'thin' | |
gem 'usher', "0.6.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem "bson_ext" | |
gem "haml" | |
gem "mongoid", ">= 2.0.0.beta.16" | |
gem "mongoid_rails_migrations" | |
gem "rails3-generators" | |
gem "database_cleaner", :group => :test | |
gem "rspec-rails", ">= 2.0.0.beta.17", :group => :test | |
generators = <<-GENERATORS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
var http = require('http') | |
, webapp = require('webapp'); | |
http.createServer(webapp.bind([])).listen(8000); | |
// ^^^^^^^^^^^^^^^ | |
// | (x) | |
// ROFLSCALE DEQUE ---/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "spec_helper" | |
class ValInheritanceParent | |
include Mongoid::Document | |
field :parent_value | |
embeds_many :val_inheritance_embed | |
references_many :val_inheritance_ref |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
header nav { | |
-webkit-box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.4); | |
-moz-box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.4); | |
box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.4); } | |
html.ie8 header nav, html.ie7 header nav, html.ie6 header nav { | |
border: solid 1px #cccccc; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var map = function() { | |
var domain = this.info.url.match(/^https?:\/\/([^\/]*)/)[1]; | |
emit(domain, { duration: this.duration }); | |
}; | |
var reduce = function(key, values) { | |
var result = { duration: 0 }; | |
values.forEach(function(value) { | |
result.duration += value.duration | |
}); |
OlderNewer