Skip to content

Instantly share code, notes, and snippets.

View zerobase's full-sized avatar

Hideto Ishibashi zerobase

View GitHub Profile
@zerobase
zerobase / cleanUpDuplicatedFiles.rb
Last active December 17, 2015 17:09
To clean up duplicated files. For Mac OS X.
# For Mac OS X
# To clean up duplicated files.
# isDuplicate(fileName)
# It returns true is the files are duplicated.
# It tests:
# - a file name (before the extention) ends with [0-9], and
# - there is a same sized file without trailing [0-9] of its file name.
# For example: "Word Power Made Easy Norman Lewis 528p_067174190X 2.pdf"
# original: "Word Power Made Easy Norman Lewis 528p_067174190X.pdf"
@zerobase
zerobase / webrick.rb
Last active December 15, 2015 02:09
Simple WEBrick Command. (My ruby version: ruby 1.9.3p392 (2013-02-22 revision 39386) [x86_64-darwin12.2.0])
#!/usr/bin/env ruby
require 'webrick'
require 'optparse'
port = 8000
root = '.'
OptionParser.new do |opt|
opt.on('-p', '--port PORT', "default: #{port}") { |v| port = v }
@zerobase
zerobase / gist:4602113
Last active December 11, 2015 12:38
What I learned on Scala: * Traits with a same private var name does not conflict. * Traits with a same method name do conflict.
/**
* Traits with a same private var name does not conflict.
* Traits with a same method name do conflict.
*/
trait Countable {
private var _count:Int = 0
def count:Int = _count
def countup:Unit = _count += 1
}
@zerobase
zerobase / booklog.rb
Created November 18, 2012 20:26
Booklog API (limit 100 items?)
require 'open-uri'
require 'json'
arg = ARGV.shift
if arg.nil?
print "usage: $0 username\n"
exit
end
username = arg.strip
api_url_fmt = "http://api.booklog.jp/json/%s?count=10000"
api_url = sprintf(api_url_fmt, username)
@zerobase
zerobase / morning-relay.jade
Last active August 29, 2015 14:17
Morning Relay by Shuntaro Tanigawa
html
title Morning Relay by Shuntaro Tanigawa
script(src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js")
body.world
#kamchatka.place
.person.guy.is-dreaming.giraffe
.clock
audio(src="alarm-kamchatka-boy.mp3").alarm
#mexico.place
.person.maiden.is-waiting(for="bus")