Skip to content

Instantly share code, notes, and snippets.

def mail_to_obf(email_address, name = nil, html_options = {})
substr = ' *AT* '
ej = email_address.gsub(/@/, substr)
mt = mail_to(ej, name || ej, html_options)
javascript_tag("document.write('#{mt}'.replace('#{substr}', '@', 'g'))")
end
# 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))
# 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))
@burnto
burnto / all youtube comments in a category
Created December 8, 2009 08:10
grab retarded youtube comments for category or keyword
require 'rubygems'
require 'hpricot'
require 'open-uri'
n = ARGV[0]
n = n.gsub(/\s+/, "%2C%2D")
xml = open("http://gdata.youtube.com/feeds/api/videos?category=#{n}").read
doc = Hpricot::XML(xml)
git log --since=yesterday
git log --since="3 days ago"
git log --before=today
Array.prototype.simple_moving_average = function(window_length) {
var averaged = new Array(this.length);
var chunk = [];
for (k = 0; k < this.length; k++) {
chunk.push(this[k]);
if (chunk.length > window_length) chunk.shift();
averaged[k] = chunk.sum() / chunk.length; // sum() is an exercise left to the reader
}
return averaged;
};
@burnto
burnto / happy.md
Created October 20, 2010 02:04 — forked from huned/happy.md

Some stuff that makes me happy:

  • good decisions
  • well written, persuasive prose
  • elegant solutions
  • evocative experiences
  • genuine, honest communication
  • afterglow
  • summertime
  • doodling
hello humans
@burnto
burnto / _image_replace.scss
Created February 25, 2011 06:59
Image replacement scss mixin
// Image replacement scss mixin
@mixin image_replace($img, $width, $height, $x: 0, $y: 0) {
display: block;
background: image-url($img) no-repeat $x $y;
width: $width;
height: $height;
overflow: hidden;
text-indent: -9999em;
}