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_relative 'tasks_view' | |
class AudibleTasksView < TasksView | |
def puts(args) | |
super | |
`say '#{args}'` | |
end | |
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_relative 'router' | |
require_relative 'tasks_controller' | |
require_relative 'tasks_repository' | |
repo = TasksRepository.new | |
controller = TasksController.new(repo) | |
Router.new(controller).run |
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
module Androsphinx | |
class Node | |
# 最基础的树节点 | |
def initialize(name) | |
@name = name | |
@childrens = [] | |
end | |
def add_child(child) | |
@childrens << child |
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 the csv done | |
#create array done | |
#extract email address done | |
#push address into array done | |
#create a hash done | |
#for each address in the array | |
#if in the hash, ++ | |
#if not, set the value to 1 | |
#sort the hash by value | |
#top 5 |
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 Fixnum | |
alias :original_plus :+ | |
def +(another) | |
original_plus(another).original_plus(another) | |
end | |
end | |
puts 1 + 1 |
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
# 1. print welcome message | |
# 2. ask for first number (or exit) | |
# 3. ask for operation (or exit) | |
# 4. ask for second number (or exit) | |
# 5. perform calculation | |
# 6. show result | |
# 7. go back to 2 |
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
# Armanni TODO required file DONE | |
# grabbed text from file DONE | |
# filter the text | |
# split it with empty space DONE | |
# downcase text DONE | |
# create empty hash DONE |
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
musicians = [ | |
'Jimmy Page', | |
'Bieber', | |
'Robert Plant', | |
'John Paul Jones', | |
'John Bonham' | |
] | |
# def print_musicians(musicians) |
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
forrest_is_handsome && forrest_is_tall # => false | |
forrest_is_handsome || forrest_is_tall # => true |
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 colorful?(number) | |
nums = number.to_s.split('').map(&:to_i) | |
results = [] | |
(1..nums.size).each do |batch_size| | |
(0..(nums.size - batch_size)).each do |start_pos| | |
product = nums[start_pos, batch_size].inject(&:*) |