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 'capybara/poltergeist' | |
Capybara.register_driver :poltergeist do |app| | |
Capybara::Poltergeist::Driver.new(app, js_errors: false, timeout: 5000) | |
end | |
session = Capybara::Session.new(:poltergeist) | |
session.driver.headers = { | |
'User-Agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2564.97 Safari/537.36' |
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 'open-uri' | |
require 'csv' | |
require 'pp' | |
# http://okzk.org/blog/openuri_treat_under_10kb | |
# Don't allow downloaded files to be created as StringIO. | |
# Force a tempfile to be created. | |
if OpenURI::Buffer.const_defined?('StringMax') | |
OpenURI::Buffer.send :remove_const, 'StringMax' | |
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
CSV.open('syukujitsu.csv', encoding: 'CP932') | |
.map{|row| row.each_slice(2).to_a }[0..-3] | |
.transpose.map{|year, header, *body| {year.first => body.map{|i| header.zip(i).to_h}}} |
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
module Asserting | |
class AssertionError < StandardError; end | |
module Asserter | |
def assert(condition) | |
return if condition.respond_to?(:empty?) ? !condition.empty? : !!condition | |
_, caller_filename, caller_lineno, _ = *caller[0].match(/^(.+?):(\d+)(?::in `(.*)')?/) | |
code_line = '' | |
if File.exists?(caller_filename) |
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
--- | |
IrresponsibleModule: | |
enabled: false | |
DuplicateMethodCall: | |
allow_calls: | |
- 'Rails.logger' |
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
inherit_from: .rubocop_todo.yml | |
AllCops: | |
Include: | |
- '**/Rakefile' | |
- '**/config.ru' | |
Exclude: | |
- 'db/**/*' | |
- 'config/**/*' | |
- 'script/**/*' | |
- 'bundle_bin/*' |
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 Module | |
def const_missing(name) | |
name_str = name.to_s | |
cooked_str = name_str[/\A[A-Z]+?_([A-Z]|_)\z/].present? ? | |
name_str.gsub(/(?<=.)(?=_.|\z)/, '[A-Z]*?') : | |
name_str.gsub(/(?<=.)(?=[A-Z]|\z)/, '[a-z]*?') | |
end | |
finded_const_name = constants.grep(/\A#{cooked_str}\z/).max |
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
org 100h | |
start: | |
mov al, [82h] | |
sub al, '0' | |
mov cl, al | |
mov [hellolen], al | |
startloop: |
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
org 100h | |
start: | |
mov dx, msg | |
mov ah, 09h | |
int 21h | |
mov ah,4Ch | |
int 21h | |
msg db 'Hello World', 0Dh, 0Ah, '$' |
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
org 100h | |
start: | |
mov si, msg | |
printloop: | |
lodsb | |
mov ah, 0eh | |
mov bh, 00h | |
mov bl, 07h | |
int 10h |
NewerOlder