- Thermometer
- Barometer
- Plug PC: One that has a battery, networking and can be connected to a wall socket. Refer: [Plug computer][1] OR [Intel Compute Stick][2] (but of course with Linux)
- Water purifier
- Induction cooker
- AC
- Pen drive
- Hard disk
- Desktop speakers
- Car entertainment sets (MP3 player + speakers)
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
git 765 ############################################################ | |
gc 653 #################################################### | |
ag 519 ######################################### | |
h 508 ######################################## | |
c 465 ##################################### | |
dv 416 ################################# | |
rm 342 ########################### | |
mv 319 ########################## | |
curl 271 ###################### | |
fo 268 ###################### |
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 RainDrops | |
SOUNDS = { 3 => 'Pling', 5 => 'Plang', 7 => 'Plong' } | |
def make_sound(number) | |
result = SOUNDS.each_with_object([]) do |(factor, sound), record| | |
record << sound if number % factor == 0 | |
end | |
result.empty? ? number : result.join | |
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
class Theatre | |
COST = { running: 3, fixed: 180 } | |
attr_accessor :number_of_audience, :ticket_price | |
def revenue | |
@number_of_audience * @ticket_price | |
end | |
def total_cost |
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 Base | |
def initialize(alphabets) | |
@alphabets = alphabets | |
end | |
def base | |
@alphabets.length | |
end | |
def to_decimal(number) |
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 'minitest' | |
# require 'minitest/reporters' | |
# Minitest::Reporters.use! [Minitest::Reporters::DefaultReporter.new({color: true})] | |
class Range | |
include Comparable | |
def <=>(other) | |
self.begin <=> other.begin | |
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
class SittingDuck | |
include Robot | |
def tick events | |
turn_radar 5 if time == 0 | |
fire 3 unless events['robot_scanned'].empty? | |
turn_gun 10 | |
@last_hit = time unless events['got_hit'].empty? | |
if @last_hit && time - @last_hit < 20 |
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 'curb' | |
require 'nokogiri' | |
require 'date' | |
CURRENT_DATE = Date.today.strftime("%Y-%-m-%d") | |
link = "http://www.hongkongairport.com/flightinfo/eng/real_arrinfo.do?fromDate<wbr>=#{CURRENT_DATE}" | |
USER_AGENT = "Mac / Firefox 29: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:29.0) Gecko/20100101 Firefox/29.0" |
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
Email Email | |
Land Land | |
Mobile Mobile | |
Address Address | |
FeedBack FeedBack | |
Enter (case Enter |
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
# Original | |
movies.group_by do |movie| | |
movie.genre | |
end.map do |month, list| | |
[month, list.size] | |
end.sort_by(&:last).reverse | |
# Alternative |