Skip to content

Instantly share code, notes, and snippets.

John Careaga johnc219

  • Boston
View GitHub Profile
View sierpinski.rb
# Calculate number of triangles (that don't contain triangles) inside a
# Sierpinski triangle
module Sierpinski
# @param [Integer] n - number of iterations
# @return [Integer] the number of triangles that don't contain triangles
#
# f(n) = 4(f(n - 1) - f(n - 2)) + f(n - 2)
# T(n) in O(n)
def self.triangles(n)
raise 'must be nonnegative' if n < 0
View switch_statements.rb
## -----------------------------------------------------------------------------
## Replace Type Code With Subclasses
## Replace Conditional with Polymorphism
## -----------------------------------------------------------------------------
# Start
class Animal
def initialize(type_code)
@type_code = type_code
View rpi-notes.md

Raspberry Pi Onboarding Steps

  • Updating packages
    • sudo apt-get update
    • sudo apt-get upgrade
    • sudo apt-get clean
    • sudo apt-get autoremove
  • Installing Vim
    • sudo apt-get vim
  • Apply a .vimrc
  • Change default editor
You can’t perform that action at this time.