Skip to content

Instantly share code, notes, and snippets.

Javier Soto sotoseattle

  • Seattle, WA
Block or report user

Report or block sotoseattle

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View mendel.rb
require 'minitest/autorun'
require 'minitest/pride'
class Mendel
attr_accessor :bag_o_cats
ALLE = {black: 'FF', grey: 'Ff', white: 'ff'}
DOMN = 'F'
CARD = 2
View gol2.rb
#!/usr/bin/ruby -w
require "graphics"
require "set"
class ZenspiderGol
delta = [-1, 0, 1]
same = [0, 0]
DELTAS = (delta.product(delta) - [same]).sort
View pepe.rb
require 'graphics' # we'll assume this is always required
class Ball < Graphics::Body
G = V[0, -18 / 60.0]
attr_accessor :g
def initialize w
View Pascal Triangle
# Pascal Triangle
What is a Pascal Triangle? For the 1% of the mathematically inclined it is just "a triangular array of the binomial coefficients". For us, the 99% of mere mortals, we know a Pascal Triangle when we see it:
![How to gif](
[Wikipedia Link](
This week's exercise is to generate a Pascal Triangle two ways:
View Exercise ????
My brain hurts!!
Adding numbers makes my head hurtzzz. I can only add and subtract 1s using my fingers (and I only have so many!).
Help me make a method that adds 2 numbers but only uses adding 1 at a time!
**Bachelor Degree**: Do it iteratively, and carry with you the total until you reach the solution.
**Master Degree**: Do it recursively, meaning that the method calls itself again and again, oh shit, my brian hurtzz!

Ping Pang Pong!

You are back to the future. It is 1972. You, freshly out of high school and after a whole night of BBS and root beer have had an epiphany, a great idea that will make you rich: a video game console called Ataxy, and a game of tabble tennis you will call Ping Pang Pong! The goal of this exercise is to write the video game's software.

Using the graphics gem create a canvas in which a single ball/point bounces against the walls.


  • Minimum: the ball hits the wall and shows up in the opposite wall (like Asteroids)
  • Intermediate: the ball hits the wall and it deflects with the right angle.
  • Advanced: Add a paddle (a horizontal movable wall) that you can control, and play Ping Pang Pong!!

Dammit, Admin!

Given a directory as input, compute the size of all the files it holds.

  • Code it recursively & iteratively.
  • Can you think of other ways to go about it?

Pocket Change

Calculate the number of ways to change any given amount of money using the following pocket change: half-dollars (0.50), quarters (0.25), dimes (0.10), nickels (0.05), and pennies (0.01).


Question: How many different ways can we make change of $ 1.00?

Answer: 292 (different ways)
View wtf.rb
require 'primo'
ASS = %w(FF Ff ff)
module Probe
def puffreduce(probs, rango)
negos ={|p| 1-p}
ixes = (0..(probs.size-1)).to_a
sol = 0
rango.each do |i|
sotoseattle / gist:32ded13b63c471524812
Last active Aug 29, 2015
Ahmad, this is the code we were talking about in the Ruby meetup
View gist:32ded13b63c471524812
def sortable_in_1_swoop? a
c ={ |e| e.first != e.last }.count
c == 0 || c == 2
p true == sortable_in_1_swoop?([5, 3, 3, 1, 7])
p true == sortable_in_1_swoop?([1, 5, 3, 1, 7])
p false == sortable_in_1_swoop?([9, 3, 3, 1, 7])
p false == sortable_in_1_swoop?([5, 4, 3, 1, 7])
p true == sortable_in_1_swoop?([6, 3])
You can’t perform that action at this time.