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 Foo | |
attr_accessor :me | |
def initialize(arg) | |
@me = arg | |
end | |
end | |
class Bar | |
def execute |
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
=Navigating= | |
visit('/projects') | |
visit(post_comments_path(post)) | |
=Clicking links and buttons= | |
click_link('id-of-link') | |
click_link('Link Text') | |
click_button('Save') | |
click('Link Text') # Click either a link or a button | |
click('Button Value') |
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
# 超簡易webサーバ | |
require "webrick" | |
include WEBrick | |
HTTPServer.new(Port: 8888, DocumentRoot: ".").start |
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
ruby -r 'webrick' -e 'include WEBrick;HTTPServer.new(Port: 8888, DocumentRoot: "public_html/").start' |
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
(Date.new(2001,1,1)..Date.new(2019,12,31)).select { |x| | |
str = x.to_s.gsub('-0','') | |
str.split('').uniq.size == str.size | |
}.size | |
=> 210 |
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
PATH=$HOME/.rvm/bin:$PATH | |
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" |
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
# ~/.tmuxinator/rails_app.yml | |
# you can make as many tabs as you wish... | |
project_name: rails_app | |
project_root: ~/src/rails/rails_app | |
tabs: | |
- main: | |
layout: even-horizontal | |
panes: | |
- #shell |
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 AgeCalc | |
attr_accessor :birthday | |
def age | |
@age ||= calculate_age | |
end | |
def calculate_age | |
if @birthday | |
(Time.now.strftime("%Y%m%d").to_i - @birthday.strftime("%Y%m%d").to_i) / 10000 |
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
# -*- coding: utf-8 -*- | |
require './age_calc' | |
require 'date' | |
describe AgeCalc do | |
before do | |
@age_calc = AgeCalc.new | |
end | |
it "birthdayで誕生日が設定できること" do |
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
Process: ruby [60151] | |
Path: /Users/USER/*/ruby | |
Identifier: ruby | |
Version: ??? (???) | |
Code Type: X86-64 (Native) | |
Parent Process: ruby [60090] | |
Date/Time: 2012-05-11 16:15:34.942 +0900 | |
OS Version: Mac OS X 10.7.3 (11D50b) | |
Report Version: 9 |