Skip to content

Instantly share code, notes, and snippets.

View forresty's full-sized avatar

Feng Ye forresty

View GitHub Profile
require_relative 'tasks_view'
class AudibleTasksView < TasksView
def puts(args)
super
`say '#{args}'`
end
end
require_relative 'router'
require_relative 'tasks_controller'
require_relative 'tasks_repository'
repo = TasksRepository.new
controller = TasksController.new(repo)
Router.new(controller).run
module Androsphinx
class Node
# 最基础的树节点
def initialize(name)
@name = name
@childrens = []
end
def add_child(child)
@childrens << child
#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
class Fixnum
alias :original_plus :+
def +(another)
original_plus(another).original_plus(another)
end
end
puts 1 + 1
# 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
# 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
musicians = [
'Jimmy Page',
'Bieber',
'Robert Plant',
'John Paul Jones',
'John Bonham'
]
# def print_musicians(musicians)
forrest_is_handsome && forrest_is_tall # => false
forrest_is_handsome || forrest_is_tall # => true
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(&:*)