View apis.txt
Google apps
Tasks (TODO list?)
Drive (like s3?)
Forms (like a generalized survey?)
View same_bday.rb
# inspired by
SAMPLES = 50_000
DAYS = 365
def prob_of_same_bday(num_people)
SAMPLES.times.count { share_bday_in_room_of_size? num_people } / SAMPLES.to_f
def share_bday_in_room_of_size?(num_people)
View graphql_example.rb
require 'graphql'
Post = :id, :title, :body, :comments
PostType = GraphQL::ObjectType.define do
name "Post"
description "A blog post"
field :id, !types.Int # the bang means "non nullable"
field :title, !types.String
field :body, !types.String
View 1_this_is_what_finally_worked.js
class ComparableArray extends Array {
constructor(leftIsBest, ...elements) {
Object.defineProperties(this, {
leftIsBest: { value: leftIsBest },
constructor: {
value: new Proxy(ComparableArray, {
construct: (klass, args, idk) => new klass(leftIsBest, ...args)
View interface.rb
require_relative 'users'
users =
loop do
puts "---------------------------------"
puts "Menu:"
puts "1. Add a user"
puts "2. List users"
puts "3. Sort users by name A to Z"

If you're feeling exhausted from putting in that effort to figure it out, then I understand. If you're worried about my time, then don't sweat it, it's good for me to experience the difficulty users experience when I don't get things right.

Additionally, SiB is a way of approaching problem solving. If you develop the habit of using it, it's deeply effective and figuring out how to explore problems with SiB is good for your brain. Given that, it's best to establish the habit of using it to experiment as early as possible. Otherwise, you get it installed later, but you've developed a habit of irb or pry or running the tests. Then you don't take advantage of a situation where SiB would be very valuable.

As an example of why getting in the habit of using SiB is useful for your brain, it requires you to see that a hash in the middle of a rails controller, whose keys are user names and values are counts of something or other pulled out of the database... that's still just a hash, and you can experiment on a hash

forEachEncoding() {

echo "$code"

echo -n '  LANG=                      | '
LANG= ruby -e "p $code"

echo -n '  LANG=en_US.IBM437          | '
# Part of a post here:
ruby -e 'loop { p eval gets }'
ruby -e '
bnd = binding() # gets a new binding
loop { p bnd.eval gets } # eval within the same binding each time
ruby -r readline -e '

Moved here because markdown files in gists can't embed the gist's images -.-

View pipeline.rb
# Read initial standard input from the data segment at the end of the file
# You can also see what is ultimately output down there
pos = DATA.pos # => 1617
$stdin.reopen __FILE__ # => #<IO:/var/folders/7g/mbft22555w3_2nqs_h1kbglw0000gn/T/seeing_is_believing_temp_dir20161210-36802-czciw7/program.rb>
$ pos, :SET # => 0
# The commands that will be piped together
commands = [
%w[tr a A],