-
Ruby!
-
With Rails you focus on delivering value to your users. => Dave Thomas
-
Active Record {:amazing_syntax, :migration, }
-
Fast development => {:plugins, :generators}
-
Easy deploy => Capistrano
-
Convention over Configuration
-
Less code
-
Work agile
This file contains 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 'matrix' | |
require 'pp' | |
a = Matrix[ [1,2], [3,4]] | |
b = Matrix[ [4,3], [2,1]] | |
pp a | |
pp b |
This file contains 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 'net/ssh' | |
host = IO.readlines('test1.txt') # full path of servers' list | |
port = 22 # SSH port | |
user = 'root' # username | |
pass = "123123" # password | |
i = 0 | |
begin | |
cmd = ["sudo /sbin/ip addr | grep mtu | grep -v lo | awk '{print $2}'", # Interfaces |
This file contains 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
# DictOptions is OrderedOptions copy for python. | |
# Basic idea: insted of use dict like this d['key'] = value use it as proprties d.key = value | |
# | |
# Examples: | |
# config = DictOptions() | |
# config.app_name = "Dictionary Test" | |
# config.database = "mysql" | |
# config.server = DictOptions() | |
# config.server.processes = 5 | |
# ... |
This file contains 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 Node | |
attr_accessor :dad, :name | |
def initialize(name='', dad=nil) | |
@name, @dad = name, dad | |
end | |
def inspect | |
"My dad is #{@dad} " | |
end |
This file contains 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 'date' | |
def season(date) | |
case date.yday | |
when 80..202 then "Spring" | |
when 203..264 then "Summer" | |
when 265..355 then "Autumn" | |
else | |
"Winter" | |
end |
This file contains 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 'csv' | |
require 'json' | |
require 'itunes-search-api' | |
require 'market_bot' | |
query = ARGV.first | |
puts query |
NewerOlder