Skip to content

Instantly share code, notes, and snippets.

View Supernats's full-sized avatar

Nathan Seither Supernats

View GitHub Profile
class Cat
attr_accessor :name
def initialize(name)
@name = name
end
def self.chorus(noise_method, *cats)
cats.each do |cat|
cat.make_noise(noise_method)
require 'set'
class TwoPowArray
def self.make(count)
pow_arr = Array.new(count)
pow_arr.length.times do |pow|
pow_arr[pow] = 2 ** pow
end
class Cat
attr_accessor :name, :color
def initialize(name, color)
@name, @color = name, color
end
def meow
puts "#{ name } says meow"
end
@Supernats
Supernats / cli_tool_chest.md
Last active February 20, 2020 15:31
My favorite cli tools

Command Line Tool Chest

I love the command line. Providing discrete, concrete instructions to my machine just feels like the way things should be done. This Gist shall serve as a record of the tools that enhance my terminal fu. If you like the terminal (you should) maybe you should consider some of them. ENJOY!

===

Homebrew

Homebrew is my installer of choice (for Mac folk). MacPorts is also fairly

# line by line printing of array representation of full binary tree
def print_tree(els)
Math.log2(els.length).times do |i|
row = els.shift(2 ** i)
puts row
end
end
class TreeNode
attr_accessor :left, :right, :value
def initialize(value)
@value = value
end
# to be called on parent
# for full tree
def print
var afterDone = function (bool) {
if (n > 0) {
n -= 1;
} else {
BillApp.otherUsers = new BillApp.Collections.OtherUsers();
BillApp.transactions = BillApp.user.get('transactions');
BillApp.friends = BillApp.user.get('friends');
BillApp.debts = BillApp.user.get('debts');
BillApp.credits = BillApp.user.get('credits');
BillApp.router = new BillApp.Routers.Router({ $rootEl: $('#content') });
Thread.new do
loop do
`say i am a pretty pretty princess`
sleep(rand(500))
end
end
@Supernats
Supernats / attr_wtf.rb
Created June 10, 2014 21:19
attr_accessor and def cannot team up
class AttrFirst
attr_reader :age
attr_accessor :name
def initialize(age = 0)
@age = age
end
def name
make_name(5)
@Supernats
Supernats / attr_wtf.rb
Created June 10, 2014 21:40
attr_accessor and def cannot team up
class AttrFirst
attr_reader :age
attr_accessor :name
def initialize(age = 0)
@age = age
end
def name
make_name(5)