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
# -*- coding: utf-8 -*- | |
# https://twitter.com/katzchang/status/444136941605224448 | |
# is(hoge('2014-01-01 01:00', '2014-01-01 03:00'), ('2014-01-01 01:00', '2014-01-01 02:00', '2014-01-01 03:00')) より | |
# 1時間単位で開始時間と終了時間が与えられたとき => YYYY-mm-dd HH:00 が入力されるものだと予想 | |
# 寝る | |
require 'time' | |
module RefinedTime |
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
guard :shell do | |
watch 'tmp.md' do |f| | |
lines = open(f.first).readlines | |
file_name = $~[1] if lines.any?{ |l| l =~ /^__(.+)__$/ } | |
category = $~[1] if lines.any?{ |l| l =~ /^\[(.+)\]$/ } | |
if file_name && category | |
FileUtils.mkdir_p(category) | |
FileUtils.cp 'tmp.md', category + '/' + file_name |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meata charset="UTF-8"> | |
<title>HashColor</title> | |
<style> | |
body { | |
text-align: center; | |
font-family: arial; |
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
# -*- coding: utf-8 -*- | |
require 'pp' | |
require 'rubicure' | |
module PrettyCurePrinter | |
# 設定ファイルに書いた方がいい | |
# precure_name => [foreground, background] | |
PRECURE_COLOR_SETTING = { | |
'キュアブラック' => [:white, :black], | |
'キュアホワイト' => [:black, :white], |
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
import Keyboard | |
import Signal (..) | |
import Time (..) | |
import Color(rgb) | |
import Graphics.Element (..) | |
import Graphics.Collage (..) | |
import Random | |
import Time | |
type ClawPos = Left | Right |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 'rainbow' | |
class WordFreq < Hash | |
def initialize | |
super(0) | |
end | |
def add(w) | |
self[w] += 1 | |
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
# Translation | |
function gtranslation() { | |
RESULT=`ruby "gtranslation.rb のパス" "${RBUFFER}"` | |
zle push-line | |
echo "${RESULT}" | |
zle send-break | |
} | |
zle -N gtranslation | |
bindkey "^t" gtranslation |
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
# -*- coding: utf-8 -*- | |
# Google 翻訳 | |
require 'rubygems' | |
require 'json' | |
require 'open-uri' | |
URL = "http://ajax.googleapis.com/ajax/services/language/translate" | |
query = ARGV[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
#!/usr/bin/ruby | |
# 拡張子が .gz であれば、zlib でオープンする。 | |
require 'zlib' | |
module FOpener | |
def self.open( f_name ) | |
f = Filename.extname(f_name) == ".gz" ? Zlib::GzipReader.open( f_name ) : File.open( f_name ) | |
yield( f ) | |
f.close | |
end |
OlderNewer