Skip to content

Instantly share code, notes, and snippets.

@RasPhilCo
RasPhilCo / tree.rb
Last active May 20, 2016 19:44
Ruby tree with BF and DF traversal
# extended from https://stackoverflow.com/questions/10661610/implement-a-tree-iterator
class Node
attr_accessor :data, :children
def initialize(data, *children)
@data = data
@children = children
end
require 'minitest/autorun'
Tree = Struct.new(:value, :left, :right)
class TestTree < Minitest::Test
def test_is_tree_sorted_true
seven = Tree.new(7)
three = Tree.new(3)
five = Tree.new(5, three, seven)
@RasPhilCo
RasPhilCo / magic_tricks_of_testing.rb
Created November 3, 2016 23:41
Sandi Metz's Magic Tricks of Testing
require 'minitest/autorun'
require 'minitest/mock'
# From the Queen herself, Sandi Metz
# https://www.youtube.com/watch?v=URSWYvyc42M
# http://jnoconor.github.io/images/unit-testing-chart-sandi-metz.png
class Gear
attr_reader :chainring, :cog, :wheel, :observer
# git aliases
alias g 'git'
alias gst 'git status'
alias gd 'git diff'
alias gco 'git checkout'
alias ga 'git add'
alias gcm 'git commit -m'
alias gl "git log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(bold blue)%h%C(reset) - %C(bold
green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all"
@RasPhilCo
RasPhilCo / Vagrantfile
Last active April 1, 2017 19:40
barebones ubuntu with tensorflow
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.provider "virtualbox" do |vb|
vb.memory = "4096"
vb.cpus = "2"
end
@RasPhilCo
RasPhilCo / topics.md
Last active October 25, 2017 17:01
Basic Computer Science Topics

Basic CompSci Topics

from Cracking the Coding Interview

Topics

Data Structures

Linked lists

require 'singleton'
class Subscriber
include Singleton
attr_reader :subscriptions
def initialize
@subscriptions = {}
end

RasPhilCo

Repos

  • fjord
    • rasphilco/fjord
    • Simplified local node/python/ruby app development for MacOS. Powered by Heroku buildpacks.
  • rabbit hole
    • rasphilco/rh
    • Find any executable on $PATH and view its symlink chain
  • oclif