Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am robesris on github.
  • I am robesris (https://keybase.io/robesris) on keybase.
  • I have a public key ASD8tCTzCIgBKWExzxm1BDg-izBIODdLB3afCZyo5MKO7Qo

To claim this, I am signing this object:

@robesris
robesris / Monty Hall
Created December 5, 2014 21:23
A demo proving the Monty Hall problem, in Ruby
TRIES = 1000
successes = 0.0
1.upto(TRIES) do
doors = [:goat, :goat, :goat]
# put a car behind a random door
doors[(rand * 3).to_i] = :car
puts "1: #{doors[0]}"
2.0.0-p451 :001 > something = "abcdefghijk"
=> "abcdefghijk"
2.0.0-p451 :002 > a=something.sub(/(def)(.*)i/,"#{$1}#{$2}")
=> "abcjk"
2.0.0-p451 :003 > b=something.sub(/(def)(.*)i/,"#{$1}#{$2}")
=> "abcdefghjk"
2.0.0-p451 :004 > a==b
=> false
2.0.0-p451 :005 >
<?php
if ($handle = opendir('.')) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
if (is_dir($file)) {
echo "<h1>$file</h1>";
$album = opendir($file);
while (false !== ($song = readdir($album))) {
$info = pathinfo($song);
if ($info['extension'] == "mp3" || $info['extension'] == "ogg") {
module PixenToGameQuery
require 'RMagick'
include Magick
FPR = 12 # Frames per row in a sprite sheet generated by Pixen
COLPAD = 2 # Pix between each column of images on the sprite sheet
ROWPAD = 2 # Pix between each row of images on the sprite sheet
LEFTPAD = 4 # Extra pix on left of sprite sheet
RIGHTPAD = 20 # Extra pix on right of sprite sheet
BOTTOMPAD = 2 # Extra pix on bottom of sprite sheet
First, rewinding head to replay your work on top of it...
Applying Began setting up request_access feature to use email-spec
Applying Began setting up request_access feature to use email-spec
error: patch failed: app/models/access_request.rb:5
error: app/models/access_request.rb: patch does not apply
error: app/views/user_mailer/request.html.erb: already exists in index
error: db/migrate/20090418013058_create_user_mailers.rb: already exists in index
error: patch failed: features/request_access.feature:24
error: features/request_access.feature: patch does not apply
error: patch failed: features/send_email.feature:3