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
# encoding: utf-8 | |
require 'rubygems' | |
require 'sinatra' | |
require './scraping.rb' | |
require 'pry' | |
get '/' do | |
'HerokuでSinatraを使ってHello world!' | |
links = Scraping.get_top_links |
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
$ :> hoge.txt |
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
Enumerableをincludeして独自に使うときのおさらいメモ | |
Enumerableのメソッドは全てeachを用いて定義されているのでincludeしたらeachを適切に定義してやる必要がある。 | |
[1] pry(main)> class Account | |
[1] pry(main)* attr_accessor :name, :balance | |
[1] pry(main)* def initialize(name, balance) | |
[1] pry(main)* @name = name | |
[1] pry(main)* @balance = balance |
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
■Group基本設定 | |
# /usr/sbin/groupadd -g 1001 soko | |
# /usr/sbin/groupadd -g 1101 doko | |
# /usr/sbin/groupadd -g 8001 asoko | |
# /usr/sbin/groupadd -g 10001 koko | |
# | |
■user追加 | |
[root@servername ~]# /usr/sbin/useradd -g 1001 -G doko,asoko -u 1087 ssato |
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
Rails 2.x | |
Install rspec and rspec-rails plugins for Rails >= 2.1.0 | |
% ruby script/plugin install git://github.com/dchelimsky/rspec.git -r 'refs/tags/1.2.9' | |
% ruby script/plugin install git://github.com/dchelimsky/rspec-rails.git -r 'refs/tags/1.2.9' | |
% ruby script/generate rspec | |
% rake db:migrate RAILS_ENV=test |
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
exit-program | |
もしくは | |
quit-program |
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
#!/usr/bin/ruby | |
#現在の日時 | |
now_date = Time.now | |
#誕生日 | |
birth_date = Time.parse(1972,8,10) | |
#現在の日時と誕生日の差分を出し、年数に換算し、さらにフォーマット関数で年だけを表示 | |
my_age = sprintf("%d",((now_date - birth_date) / 60 / 60 / 24)/365) |
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
1.8.7だと | |
[4] pry(main)> Date.exist?(1986, 1, 7) | |
=> 2446438 | |
[5] pry(main)> if Date.exist?(1986, 1, 7) | |
[5] pry(main)* p 'soko' | |
[5] pry(main)* end | |
"soko" | |
=> nil | |
[6] pry(main)> if Date.exist?(1986, 2, 31) | |
[6] pry(main)* p 'soko' |
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
#For Mac with Homebrew | |
Update to the latest version rvm at first. | |
% rvm get latest | |
% rvm reload | |
% rvm version | |
rvm 1.18.18 (latest) by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [https://rvm.io/] | |
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
☆長距離型タスク:一定速度で淡々と走る。 | |
定型の仕事は制限時間を最大限に使ってやるのが効率的です。集中力をある程度セーブして、同じペースで仕事をし続けるのが最適となります。定型仕事には時間による給与制がピッタリです。 | |
★短距離型タスク:一気に速度を上げて走る。 | |
創造的仕事は、集中して一気にやるのが効率的です。限界の集中力で仕事をやるだけやって、力尽きたらやめるというリソース配分が最適となります。つまり、やるだけやってすぐに帰るのが合理的です。創造的な仕事は成果報酬や裁量労働制がピッタリです。 |
OlderNewer