Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Play area of tests/examples/PoCs but complex enough to version control
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
penny_arcade
README.rdoc
latest_gem_sizes.rb
monty_hall.rb
object_id_inflection.rb

README.rdoc

Sandbox

A play area. But complex enough that I need to version things. Should contain working examples and concepts. Promted from local chaos examples directory of dev boxes.

Explanation of what's in here

monty_hall.rb

From post: squarism.com/2010/12/13/monty-hall-problem-in-ruby/. An exercise in statistics/simple algorithm. Uses basic OO and no gems. Simulates a game show and tracks the results of the Monty Hall problem. More information about the Monty Hall problem on wikipedia and youtube.

object_id_inflection.rb

From post: squarism.com/2010/12/21/biggest-object_id-value-in-ruby/. Finds the largest object_id value in ruby. Essentially it's a number guessing algorithm. Ruby computes an object_id for a Fixnum up to a certain inflection point. This program finds this inflection point using only true/false feedback. The algorithm is digit based. IE: if it's guessing 525, it'd start with the hundreds digit 0 and use a simple guessing scheme to quickly (but not optimally). This is not efficient or anything mathematically significant, it was a constraint I put on myself in order to solve the problem a certain way. At the end of it, it prints the Fixnum value that produces the largest object_id you can have in ruby. It's an overflow test basically.

penny_arcade

An image scraper for the comic site Penny Arcade. It follows the next/back links in a unknown chain and creates a timestamped filename from the post date and post title. Saves all files to ~/Pictures/PA which will work in OSX and Linux. Untested on Windows. Only saves new files so you could continually run this (probably better to cron daily). An exercise in following links and dealing with an unknown chain/linked list. Uses typheous, nokogiri and threads. Scraper thread pushes work to Saver thread. Saver thread saves the comic file while Scraper follows the next/back links on the site to enumerate all the comics. Prints a status bar while it runs and shows how many are in queue. Has some basic throttling.

Something went wrong with that request. Please try again.