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
def sample | |
puts "This is sample!!" | |
end | |
class DDD | |
def d | |
#do something | |
end | |
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
def sample | |
puts "This is sample!!" | |
end | |
class DDD | |
def d | |
#do something | |
end | |
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
cl = Octokit::Client.new(access_token: config['access_token']) | |
#gistリストを取得 | |
gists = cl.gists("mizutaki") | |
gists.each do |gist| | |
file = Hash.new | |
gist.files.each {|k, v| file = v} | |
puts "#{file.filename}" | |
puts "#{gist.user.login}" | |
puts "#{gist.description}" |
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
def sample | |
puts "This is sample!!" | |
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 'octokit' | |
require 'openssl' | |
#見にいく証明書のパスを表示 | |
OpenSSL::X509::DEFAULT_CERT_FILE = "C:/Ruby22-x64/bin/cacert.pem" | |
p OpenSSL::X509::DEFAULT_CERT_FILE | |
#危険なコード HTTPS接続時にSSLチェックを行わなくする設定 | |
#OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE | |
#インスタンス化 |
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 'selenium-webdriver' | |
driver = Selenium::WebDriver.for :firefox | |
driver.navigate.to "https://www.google.co.jp/imghp?hl=ja&tab=wi" | |
element = driver.find_element(:name, 'q') | |
element.send_keys('ruby') | |
driver.find_element(:name, 'btnG').click |
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'sinatra/base' | |
class GeneralApp < Sinatra::Base | |
get '/about' do | |
"this is general app" | |
end | |
end | |
class CustomApp < GeneralApp | |
get '/about' do |
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 'sinatra' | |
set :title, "My Website" | |
#configureを使って環境依存オプションを指定する | |
configure :development, :test do | |
enable :admin_access | |
end | |
if settings.admin_access? | |
get('/admin') {'welocome to the admin area'} |
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 'sinatra/base' | |
class MyApp < Sinatra::Base | |
get '/' do | |
"Hello from MyApp!" | |
end | |
# $0は実行されるファイル | |
#__FILE__==0$は現在のファイル | |
run! if __FILE__ == $0 |
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
array = ['foo', 'bar'] | |
block = proc {first} | |
block2 = proc {last} | |
#block.call error undefined local variable or methods | |
array.instance_eval(&block) #foo | |
array.instance_eval(&block2) #bar |