Skip to content

Instantly share code, notes, and snippets.

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
require 'singleton'
class Subscriber
include Singleton
attr_reader :subscriptions
def initialize
@subscriptions = {}
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

@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
# 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 / 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
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 / 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

Larry Wall, Three Virtues --

There are three great virtues of a programmer:

  1. Laziness: The quality that makes you go to great effort to reduce overall energy expenditure. It makes you write labor-saving programs that other people will find useful and document what you wrote so you don't have to answer so many questions about it.
  2. Impatience: The anger you feel when the computer is being lazy. This makes you write programs that don't just react to your needs, but actually anticipate them. Or at least pretend to.
  3. Hubris: The quality that makes you write (and maintain) programs that other people won't want to say bad things about.

Sandi Metz, Ruby Rouges podcast --

Four rules for developers: