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
| source 'https://rubygems.org' | |
| gem 'capybara' | |
| gem 'nokogiri' | |
| gem 'pry' | |
| gem 'activesupport' | |
| group :co_meeting do | |
| gem 'poltergeist' | |
| gem 'phantomjs' |
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 'open-uri' | |
| (1..10).each do |i| | |
| fork do | |
| open("./#{i}.png", 'wb') do |f| | |
| f.write open("http://cambelt.co/200x100/#{i}.png").read | |
| end | |
| 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
| /(\d{4}) - .*(\d{4})/ =~ "Francis Crick (8 June 1916 - 28 July 2004)" | |
| $& # => "1916 - 28 July 2004" | |
| $1 # => "1916" | |
| $2 # => "2004" |
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
| ;; install go-mode | |
| (autoload 'go-mode "go-mode" "Mode for golang" t) | |
| (defun my-go-mode-hooks () | |
| (setenv "GOPATH" (concat (getenv "HOME") "/.go"))) | |
| (add-hook 'go-mode-hook 'my-go-mode-hooks) | |
| (add-to-list 'auto-mode-alist '("\\.go$" . go-mode)) | |
| (add-hook 'before-save-hook 'gofmt-before-save) |
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
| // ヒカルのGO! hikarie.go #2 http://connpass.com/event/7914/ | |
| // https://github.com/yosuke-furukawa/golang-study | |
| package main | |
| import ( | |
| "encoding/json" | |
| "fmt" | |
| "io/ioutil" | |
| "net/http" |
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
| ;; install jabber.el via elpa | |
| (require 'jabber-autoloads) | |
| (setq jabber-account-list '(("11111_99999@chat.hipchat.com" | |
| (:password . "password") | |
| (:network-server . "chat.hipchat.com") | |
| (:port . 5222)))) | |
| ;; M-x jabber-connect-all | |
| ;; => Opening STARTTLS connection to `chat.hipchat.com:5222'...failed | |
| ;; Couldn't connect to chat.hipchat.com:5222 |
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
| differ(red, blue). | |
| differ(red, green). | |
| differ(blue, green). | |
| coloring(Kagawa, Ehime, Tokushima, Kochi) :- | |
| differ(Kagawa, Ehime), | |
| differ(Kagawa, Tokushima), | |
| differ(Kagawa, Kochi), | |
| differ(Tokushima, Kochi), | |
| differ(Ehime, Kochi). |
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
| # | |
| # DO NOT MODIFY!!!! | |
| # This file is automatically generated by Racc 1.4.11 | |
| # from Racc grammer file "". | |
| # | |
| require 'racc/parser.rb' | |
| class IntpParse < Racc::Parser | |
| ##### State transition tables begin ### |
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
| open('test.txt', 'a+') do |f| | |
| f.puts 'last line' | |
| end | |
| $ cat test.txt | |
| line1 | |
| line2 | |
| last line |
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 MyAppException < StandardError; end | |
| def divide100(n) | |
| 100 / n | |
| rescue | |
| raise MyAppException.new('My application is facing exception in divide100') | |
| end | |
| begin | |
| p divide100(50) #=> 2 |