Skip to content

Instantly share code, notes, and snippets.

@gstark
Created April 11, 2012 17:24
Show Gist options
  • Save gstark/2360699 to your computer and use it in GitHub Desktop.
Save gstark/2360699 to your computer and use it in GitHub Desktop.
((rand().to_i)...rand((rand(5000).to_i))).send(Enumerable.instance_methods[rand(Enumerable.instance_methods.size)]) { rand(6) > 2 }
@oelbrenner
Copy link

this has the potential to quickly spiral out of control

@gstark
Copy link
Author

gstark commented Apr 11, 2012

I stop when I see File.delete or File.unlink or the first ` anywhwere

@oelbrenner
Copy link

or when:
ruby-1.9.2-p290 :004 > rand.class
=> Turtles

@gstark
Copy link
Author

gstark commented Apr 11, 2012

Got you covered:

def rand
  object = Object.new
  def object.class; "Turtles" end
  object
end

puts rand.class

@tylerjohnst
Copy link

begin; !!(((rand().to_i)...rand((rand(5000).to_i))).send(Enumerable.instance_methods.sample(1).first) { rand(6) > 2 })^32;rescue=>e;(e.methods-Object.methods)>rand(32);end

i call it safely random boolean

@oelbrenner
Copy link

LMAO

@gstark
Copy link
Author

gstark commented Apr 11, 2012

Are you missing a #size on (e.methods - Object.methods) ? ZOMG, am I really code reviewing this!?!?!!?

@tylerjohnst
Copy link

ah you are right :(

@gstark
Copy link
Author

gstark commented Apr 11, 2012

I guess we'll count that as "MY MOVE" ? ;-)

@tylerjohnst
Copy link

begin;!!(((rand().to_i)...rand((rand(5000).to_i))).send(Enumerable.instance_methods.sample(15).zip(Object.instance_methods.sample(15)).permutation(1).select { |a| a.length > rand(2) }.flatten.slice(rand(10))) { rand(6) > 2 })^32;rescue=>e;e.methods.product(Object.methods).slice(rand(10),rand(10)).size>rand(32);end

@gstark
Copy link
Author

gstark commented Apr 11, 2012

BTW, nice use of #sample -- forgot that was on Array.

@tylerjohnst
Copy link

Have to use as many versions of rand as possible

@tylerjohnst
Copy link

Man Enumerable#lazy is going to be awesome.

@gstark
Copy link
Author

gstark commented Apr 11, 2012

require 'open-uri'

(0..open("http://www.random.org/integers/?num=1&min=5&max=100&col=1&base=10&format=plain&rnd=new").read.to_i).count {rand(6)>2}

# Fails since I guess I exceeded random.org rate limit or something.

@ambethia
Copy link

Question.ask("Does no one here know how to use code formatting in Github Flavored Markdown?")
true

@gstark
Copy link
Author

gstark commented Apr 11, 2012

Yeah, nobody cares...

@ambethia
Copy link

But none of your code is indenting! How can you stand it?

@gstark
Copy link
Author

gstark commented Apr 11, 2012

I think it adds a certain je ne sais quoi

@ambethia
Copy link

touché

@gstark
Copy link
Author

gstark commented Apr 11, 2012

Edited comments just cause I like Jason P so much.

@tylerjohnst
Copy link

@gstark
Copy link
Author

gstark commented Apr 11, 2012

I just realized this is kinda like our mogrify app for Rails Rumble but with less porn and more code...

@ambethia
Copy link

This gist got legit.

@gstark
Copy link
Author

gstark commented Apr 11, 2012

@tylerjohnst
Copy link

is there code styling for memes?

@ambethia
Copy link

AN IDEA APPEARS.

@oelbrenner
Copy link

this gist if full of WIN

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment