Skip to content

Instantly share code, notes, and snippets.

def jangkeng(you, comp)
(you - comp + 4) % 3 - 1;
end
rock, paper, scissors = 0, 1, 2
win, lose, draw = 1, -1, 0
matches = [
# [you, comp, judge]
@higaki
higaki / init.el
Last active January 5, 2017 04:32
;; load path
(defun add-to-load-path (&rest paths)
(let (path)
(dolist (path paths paths)
(let ((default-directory
(expand-file-name (concat user-emacs-directory path))))
(add-to-list 'load-path default-directory)
(if (fboundp 'normal-top-level-add-subdirs-to-load-path)
(normal-top-level-add-subdirs-to-load-path))))))
class Array
def name
self[0]
end
def left
self[1]
end
def right
require 'minruby'
class Array
def op; self[0] end
def left; self[1] end
def right; self[2] end
def leaf?
op == "lit"
end
「設定」-「時刻と言語」-「地域と言語」-「日付、時刻、地域の追加設定」-「言語」-「オプション」-「Microsoft IME オプション」-「詳細設定」-「全般」-「編集操作」-「キー設定」を
- 「Microsoft IME」
+ 「IME Standard」
error_prompt() {
local e=$?
tput sc
printf "%*s" $COLUMNS $e
tput rc
return $e
}
PS1='\[$(error_prompt)\]\h$ '
#! /usr/bin/env ruby
require 'date'
module Schedule
def print(contents, start_time, talkers = {})
end_time = start_time
contents.each do |talk|
talk.start_time = end_time
end_time = talk.end_time
#! /usr/bin/env ruby
require 'nokogiri'
html = Nokogiri::XML(open ARGV[0])
def schedules(html, date, hall)
title = "schedule-item__title"
speaker = "schedule-item-speaker"
xpath = %|//div[@id="%s"]//tbody//td[%d]//div[@class="%s"]|
#! /usr/bin/env ruby
require 'open-uri'
module OSRK01
def self.url venue
q = "%s (肥後橋|うつぼ|靭公園|靱公園)" % venue
"https://www.google.com/search?hl=ja&q=#{URI.encode_www_form_component q}"
end