Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Code snippets for "Programming Easter Eggs" - http://chrisarcand.com/programming-easter-eggs/
public static boolean isUserAMonkey () /* Since: API Level 8 */
...
/* Returns "true" if the user interface is currently being messed with by a monkey. */
# Please do not use this method in production.
# Pretty please.
def self.I_AM_THE_DESTROYER!
# TODO: actually implement spelling error fixes
puts %Q{
Sharon: "There should be a method called I_AM_THE_DESTROYER!"
Ryan: "What should this method do?"
Sharon: "It should fix all the spelling errors on the page!"
}
end
class Pry
class Command::Wtf < Pry::ClassCommand
match(/wtf([?!]*)/)
group 'Context'
description 'Show the backtrace of the most recent exception.'
options :listing => 'wtf?'
banner <<-'BANNER'
Usage: wtf[?|!]
Show's a few lines of the backtrace of the most recent exception (also available
as `_ex_.backtrace`). If you want to see more lines, add more question marks or
exclamation marks.
wtf?
wtf?!???!?!?
# To see the entire backtrace, pass the `-v` or `--verbose` flag.
wtf -v
BANNER
...
# Returns a Duration instance matching the number of fortnights provided.
#
# 2.fortnights # => 28 days
def fortnights
ActiveSupport::Duration.new(self * 2.weeks, [[:days, self * 14]])
end
alias :fortnight :fortnights
# Equal to <tt>self[41]</tt>. Also known as accessing "the reddit".
#
# (1..42).to_a.forty_two # => 42
def forty_two
self[41]
end
implode|seppuku)
source "$rvm_scripts_path/functions/implode"
__rvm_implode
;;
answer) __rvm_Answer_to_the_Ultimate_Question_of_Life_the_Universe_and_Everything ; result=42 ;;
question) __rvm_ultimate_question ; result=42 ;;
def self.❨╯°□°❩╯︵┻━┻
puts "Calm down, bro"
end
describe "❨╯°□°❩╯︵┻━┻" do
before { $stdout = StringIO.new }
after { $stdout = STDOUT }
it "allows angry developers to express their emotional constitution and remedies it" do
Sidekiq.❨╯°□°❩╯︵┻━┻
assert_equal "Calm down, bro\n", $stdout.string
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment