This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def fb?(i,a=0,b=1) | |
b>i ?false:(b==i ?true:fb?(i,b,a+b)) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def pf(n,a=[],f=2) | |
n==f ?a<<f:n%f==0?pf(n/f,a<<f):pf(n,a,f+1) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def bs(i,a,m=0,x=a.size,h=(m+x)/2,l=a.size) | |
i==a[m]?m:(i<a[0]||i>a[l-1])||m==x-1?-1:i<a[h]?bs(i,a,m,h):bs(i,a,h,l) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'term/ansicolor' | |
require "docopt" | |
doc = <<DOCOPT | |
Usage: | |
#{__FILE__} add <task>... | |
#{__FILE__} prepend <task> | |
#{__FILE__} list <optional : --tag --priority> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require './binary_search' | |
# your rspec code here! | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require './binary_search' | |
# your rspec code here! | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require './user' | |
require './employee' | |
class Administrator < Employee | |
def initialize(name) | |
super | |
@record_access = :admin | |
@title = "Administrator" | |
@password = default_password | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'securerandom' | |
class Hospital | |
attr_accessor :name,:location | |
def initialize | |
@name = "Dev Bootcamp Asylum?" | |
@location = "717 California St" | |
@employee_count = 7 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#questions : | |
#1. how to check if file exists? Better way than opening with 'append' (+)? | |
#2. how to write to middle of file? does the entire file need to be re-written from the contents in memory? | |
class TodoList | |
def initialize() | |
@file_name = "todo_file.txt" | |
@file = File.new(@file_name,'r+') | |
@todo_list = {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Hospital | |
#name, location, number of employees | |
#number of patients | |
#login, show interface | |
#wait for user input | |
#present login menu | |
#accept credentials | |
#credentials are associated on a employee level | |
end |