Giter VIP home page Giter VIP logo

sandbox's Introduction

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.

sandbox's People

Contributors

sproinks avatar squarism avatar dependabot[bot] avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.