View mandelbrot.rb
# image @ https://twitter.com/josh_cheek/status/846199094519443456
require 'graphics'
# https://www.bowdoin.edu/~dfrancis/askanerd/mandelbrot/
#
# Consider the code:
# Z = 0
# C = /* some complex number */
# loop { Z = Z*Z + C }
#
View bezier_with_sindy.rb
# The JavaScript version is @ http://codepen.io/josh_cheek/pen/VpBJVQ?editors=0010
require 'graphics'
class BezierForSindy < Graphics::Simulation
def initialize
super 500, 500, 24
@initial_points = [
[50, h-50],
[50, 50],
[w/2-50, h-50],
View albaka_house_review.md

Initially posted on airbnb but it got cut off, so I'm posting it here to have it in full. Response on their Facebook


Albaka House Review

This place is full of the kindest warm hearted humans!

Our delightful hosts

View watching_the_planets.rb
# video @ https://vimeo.com/205930710
# to play w/ it, see http://rayhightower.com/blog/2017/02/15/animated-graphics-in-ruby/
require 'graphics'
class Universe < Graphics::Simulation
def initialize
super 800, 600, 24
color.default_proc = -> h, k { k }
@tail_duration = 5 # How many frames to show their tail for
num_planets = 100 # Fewer allows more nuanced interactions, more keeps it from feeling empty
View minesweeper.rb
# vid @ https://twitter.com/josh_cheek/status/835884161047080960
# and @ https://vimeo.com/205773556
require 'graphics'
class MineSweeper
class Cell
def initialize(mine:, clicked:, marked:, x:, y:, count:)
@x, @y, @mine, @clicked, @marked, @count =
x, y, mine, clicked, marked, count
end
View goldstein_numbers.rb
# Based on "How Infinity Explains the Finite" from PBS Infinite Series
# https://www.youtube.com/watch?v=oBOZ2WroiVY
# How to find the next goodstein number
#
# For 13 in base 2
# 13
# = 2^3 + 2^2 + 2^0
# = 2^(2^1 + 2^0) + 2^(2^1) + 2^0
# Switch 2s in the base to 3s
View get_the_browser_to_talk_to_you.html
<!doctype html>
<!-- http://codepen.io/josh_cheek/pen/WpeqKp -->
<meta charset="utf-8"/>
<textarea autofocus cols="30" rows="6">Nuestras gatas beben leche</textarea>
<button onclick="say(document.querySelector('textarea').value)">
¡Hablas!
</button>
<script>
View location_distance.rb
loc1_name = 'Chicago' # => "Chicago"
loc2_name = 'Houston' # => "Houston"
# Get the lib with `gem install geocoder`
# it ultimately calls out to this API: http://maps.googleapis.com/maps/api/geocode/json?address=Chicago&language=en&sensor=false
require 'geocoder' # => true
include Math # => Object
def radians(n)
n * PI / 180 # => 0.7309109668442155, -1.5294285014482003, 0.5194174327134308, -1.664517065837707
View sampling_rate.rb
# image @ https://twitter.com/josh_cheek/status/833892618656477185
fn = -> ø, r { Math.sin(ø*r)*10+r }
include Math
require 'graphics'
d = Graphics::Drawing.new 800, 600, 24
sqrt(d.w**2+d.h**2)./(10).round.times { |r|
0.step(to: PI/2, by: 0.0075)
.map { |ø| [ø, fn[ø, r*10]] }
.each_cons(2) { |(ø1, r1), (ø2, r2)|
View shutter.rb
require "graphics"
class Shutter < Graphics::Simulation
CLEAR_COLOR = [36, 30, 10]
def initialize
super 800, 450, 24
@points = [
[-1, -1],
[-w/2, h/2],