*   \   &   ©   |   /   * *   \   &   ©   |   /   * *   \   &   ©   |   /   * *   \   &   ©   |   /   * *   \   &   ©   |   /   *

posts tagged 'ruby'

Wikiswarm: visualize Wikipedia page histories

A visualization of people who’ve contributed to the Barack Obama page on Wikipedia. People who edit a lot drift toward the center. Best watched full screen in HD on Vimeo

Made using code_swarm and my new Wikipedia page history parser Wikiswarm (Ruby), which uses the Wikipedia API to convert page edit histories into the code_swarm activity log format. There’s also experimental support for visualizing individual users’ contributions.

For info on how to generate your own wikiswarms read on…

RickrollDB: never get rickroll'd again

Have you ever clicked what appears to be an awesome link and received a rendition of Rick Astley’s hit single, “Never Gonna Give You Up” instead? You, sir, have been rickrolled.

Don’t know what I’m talking about? Click here:

Presenting the #1 weapon in the war on rickrolls: the Rickroll Database

  • install Firefox and the AdBlock Plus extension, which blocks ads, but not rickrolls
  • subscribe to the Rickroll blacklist
  • no more rickrolls for you my friend

There’s also simple user vetting of the roll-itude of blacklisted URLs; confirm or dispute entries for mad props & fame


x-posted on the Free Art & Technology Lab

How to scrape MySpace, YouTube, BitJunkie

scrape, scraping, screenscraping, web scraping, scrape myspace, scrape youtube, scrape torrents, scraping code, scraper code, scraper example, ruby, mechanize, ruby mechanize, ruby scraper, mechanize scraper

Bootstrap your career in data hacking! With Ruby and WWW::Mechanize you can get started collecting data on the web with just a few lines of code.

download Jdubs’ mechanize scrapers 1.0 — simple scraping examples for MySpace, YouTube, and torrent index BTjunkie.

Techniques for exploring a web page, Ruby & gem installation, and explanations of the simple extractors below.

Always render Rails views without the full layout when using AJAX & degradable javascript

Rails-fu

Been neck-deep in Ruby on Rails the last few months, here’s my first nugget o’ code wisdom:

With unobtrusive javascript all of my Rails views may or may not be getting called via AJAX. Adding “:layout => :false if request.xhr?” all the time was bad code smell.

Here’s a 4 liner to extend the ‘render’ method and check if the view, partial, EJS etc. are being called via an XmlHttpRequest, in which case we want to ignore the layout unless explicitly asked to. Throw it in your ApplicationController and degrade away!


def render(*args)
  	args.first[:layout] = false if request.xhr? and args.first[:layout].nil?
	super
end

Might package this little guy into a plugin I find it so handy