- yhirano55(@yhirano55)
- てぃーびー/Katsuhiko Tabei(@tbpgr)
- 伊藤 浩一/Koichi Ito(@koic)
- 伊藤 淳一/Junichi Ito(@JunichiIto)
- 江森 真由美/Mayumi Emori(@emorima)
- 三浦 英樹/Miura Hideki(@miura1729)
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 | |
def self.before_action(hook, only:) | |
actions = Array(only) | |
self.prepend Module.new { | |
actions.each do |action| | |
class_eval <<-RUBY, __FILE__, __LINE__+1 | |
def #{action} | |
#{hook} | |
super | |
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
require 'jekyll' | |
require 'open3' | |
module Jekyll | |
class EvalCode < Jekyll::Generator | |
def generate(site) | |
@site = site | |
site.pages.each { |page| eval_code(page) if page.html? } | |
site.posts.docs.each { |page| eval_code(page) } | |
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
% zdump -v Europe/London | egrep '194[0-5]' | |
Europe/London Sun Feb 25 01:59:59 1940 UT = Sun Feb 25 01:59:59 1940 GMT isdst=0 gmtoff=0 | |
Europe/London Sun Feb 25 02:00:00 1940 UT = Sun Feb 25 03:00:00 1940 BST isdst=1 gmtoff=3600 | |
Europe/London Sun May 4 00:59:59 1941 UT = Sun May 4 01:59:59 1941 BST isdst=1 gmtoff=3600 | |
Europe/London Sun May 4 01:00:00 1941 UT = Sun May 4 03:00:00 1941 BDST isdst=1 gmtoff=7200 | |
Europe/London Sun Aug 10 00:59:59 1941 UT = Sun Aug 10 02:59:59 1941 BDST isdst=1 gmtoff=7200 | |
Europe/London Sun Aug 10 01:00:00 1941 UT = Sun Aug 10 02:00:00 1941 BST isdst=1 gmtoff=3600 | |
Europe/London Sun Apr 5 00:59:59 1942 UT = Sun Apr 5 01:59:59 1942 BST isdst=1 gmtoff=3600 | |
Europe/London Sun Apr 5 01:00:00 1942 UT = Sun Apr 5 03:00:00 1942 BDST isdst=1 gmtoff=7200 | |
Europe/London Sun Aug 9 00:59:59 1942 UT = Sun Aug 9 02:59:59 1942 BDST isdst=1 gmtoff=7200 |
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
#!/usr/bin/env ruby | |
# frozen_string_literal: true | |
require 'nkf' | |
require 'socket' | |
Socket.tcp_server_loop(6668) do |socket, client_addr| | |
begin | |
begin | |
ircnet_socket = Socket.tcp('irc.ircnet.ne.jp', 6667) |
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
#!/bin/sh | |
set -eux | |
mkdir /tmp/x | |
cd /tmp/x | |
git init | |
echo hello > hello.txt | |
git add . | |
git commit -m "Initial commit" | |
git remote add origin /tmp/repo | |
mkdir /tmp/repo |
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 'benchmark' | |
Benchmark.bmbm do |x| | |
n = 1000000 | |
x.report('^$ 0 ') { n.times { 0.class.to_s =~ /^(Integer|Fixnum|FalseClass|TrueClass|NilClass)$/ } } | |
x.report('\A\z 0 ') { n.times { 0.class.to_s =~ /\A(Integer|Fixnum|FalseClass|TrueClass|NilClass)\z/ } } | |
x.report('^$ nil') { n.times { nil.class.to_s =~ /^(Integer|Fixnum|FalseClass|TrueClass|NilClass)$/ } } | |
x.report('\A\z nil') { n.times { nil.class.to_s =~ /\A(Integer|Fixnum|FalseClass|TrueClass|NilClass)\z/ } } | |
x.report('^$ x ') { n.times { x.class.to_s =~ /^(Integer|Fixnum|FalseClass|TrueClass|NilClass)$/ } } | |
x.report('\A\z x ') { n.times { x.class.to_s =~ /\A(Integer|Fixnum|FalseClass|TrueClass|NilClass)\z/ } } | |
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
% rbenv exec irb -r irb/completion --simple-prompt | |
>> RUBY_DESCRIPTION | |
=> "ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin14]" | |
>> (0x0...0xD800).lazy.map{|u|u.chr(Encoding::UTF_8)}.grep(/\p{Katakana}/).each{|c|print c} | |
ァアィイゥウェエォオカガキギクグケゲコゴサザシジスズセゼソゾタダチヂッツヅテデトドナニヌネノハバパヒビピフブプヘベペホボポマミムメモャヤュユョヨラリルレロヮワヰヱヲンヴヵヶヷヸヹヺヽヾヿㇰㇱㇲㇳㇴㇵㇶㇷㇸㇹㇺㇻㇼㇽㇾㇿ㋐㋑㋒㋓㋔㋕㋖㋗㋘㋙㋚㋛㋜㋝㋞㋟㋠㋡㋢㋣㋤㋥㋦㋧㋨㋩㋪㋫㋬㋭㋮㋯㋰㋱㋲㋳㋴㋵㋶㋷㋸㋹㋺㋻㋼㋽㋾㌀㌁㌂㌃㌄㌅㌆㌇㌈㌉㌊㌋㌌㌍㌎㌏㌐㌑㌒㌓㌔㌕㌖㌗㌘㌙㌚㌛㌜㌝㌞㌟㌠㌡㌢㌣㌤㌥㌦㌧㌨㌩㌪㌫㌬㌭㌮㌯㌰㌱㌲㌳㌴㌵㌶㌷㌸㌹㌺㌻㌼㌽㌾㌿㍀㍁㍂㍃㍄㍅㍆㍇㍈㍉㍊㍋㍌㍍㍎㍏㍐㍑㍒㍓㍔㍕㍖㍗=> nil | |
>> (0xE000...0xFFFF).lazy.map{|u|u.chr(Encoding::UTF_8)}.grep(/\p{Katakana}/).each{|c|print c} | |
ヲァィゥェォャュョッアイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワン=> nil | |
>> (0x10000...0x10FFFF).lazy.map{|u|u.chr(Encoding::UTF_8)}.grep(/\p{Katakana}/).each{|c|print c} | |
𛀀=> nil | |
>> |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<title>bootstrap3のinput[file]のテスト</title> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css"> | |
</head> | |
<body> |
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
#!/usr/bin/env ruby | |
# -*- coding: utf-8 -*- | |
$str = "abcd" | |
data = %w[ | |
0 14 5 14 | |
32 0 38 12 | |
46 28 0 7 | |
33 18 44 0 | |
] | |
data = data.map(&:to_i) |
NewerOlder