Skip to content

Instantly share code, notes, and snippets.

View katoy's full-sized avatar

revers katoy

  • japan/tokyo
View GitHub Profile
@katoy
katoy / preview-md.coffee
Created February 26, 2012 03:29
realtime markdown preview with Socket.IO and pandoc
# See - https://gist.github.com/1098762
# > realtime markdown preview with Socket.IO
fs = require 'fs'
http = require 'http'
pandoc = require 'pdc' # npm insall pdc, Alse need instll pandoc on PATH.
socket = require 'socket.io' # npm install socket.io
target = process.argv[2]
#
# https://github.com/katoy/CaptureSite (java) の ruby 版
#
require 'rubygems'
require 'watir-webdriver' # gem install watir-webdriver
require 'selenium-webdriver' # gem install selenium-webdriver
require 'uri'
require 'pp'
@katoy
katoy / pandoc-pdf
Created May 4, 2012 03:36
pandoc-pdf: generate pdf using pandoc, markdonw is include kanji.
#!/bin/bash
#
# usage:
# pandoc-pdf 1.md 1.pdf
# generater 1.md -> 1.pdf
# 1.md: utf-8 encoding
#
# How to make TEMPLATEFILE:
# $ pandoc -D latx > template-kanji.latex
# Edit templte-kanji.latex, add
@katoy
katoy / cp_r.rb
Last active October 6, 2015 00:38
Sample: Copy directory-tree with convert encoding to UTF8.
# 再帰的に Directory 階層を copy していく。
# ただし、 copy するのは *.uws, *.UWS だけを対象とし、utf-8 に encoding 変換もする。
#
# using ruby 1.8.7
# 2012-06-10 katoy
require 'rubygems'
require 'fileutils'
require 'pp'
require 'kconv'
@katoy
katoy / README.md
Created June 10, 2012 17:14
Add def for uwsc to cloc.pl

See http://cloc.sourceforge.net/#custom_lang.

$ cloc --by-file-by-lang -read-lang-def=my_definitions.txt ~/github/uwsc/uwsc

       4 text files.
       4 unique files.                              
       0 files ignored.

http://cloc.sourceforge.net v 1.56 T=0.5 s (8.0 files/s, 812.0 lines/s)
@katoy
katoy / ang-uwsc.js
Created June 16, 2012 21:49
google-code-prettify language-handlers for uwsc.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
@katoy
katoy / memo.txt
Created June 24, 2012 02:49
jenkins-tap
次のコマンド実行で、tap 出力から html レポートを生成できる。
$ prove -Q --exec="bacon --tap" --formatter=TAP::Formatter::HTML test.rb > 1.html
生成レポートの例;
http://www.spurkis.org/TAP-Formatter-HTML/test-output.html
@katoy
katoy / calc.jison
Created July 28, 2012 05:33
sample for jison
/* description: Parses end executes mathematical expressions. */
/* lexical grammar */
%lex
%%
\s+ /* skip whitespace */
[0-9]+("."[0-9]+)?\b return 'NUMBER'
"*" return '*'
"/" return '/'
@katoy
katoy / sample_roo.rb
Created September 19, 2012 02:54
Sample for roo
# See http://roo.rubyforge.org/rdoc/index.html
# roo: This gem allows you to access the content of
# Open-office spreadsheets (.ods)
# Excel spreadsheets (.xls)
# Google (online) spreadsheets
# Excel’s new file format .xlsx
require 'rubygems'
# require 'roo' # なぜかエラーになるので...
require '\ruby\Ruby187\lib\ruby\gems\1.8\gems\roo-1.10.1\lib\roo.rb'
@katoy
katoy / Division.java
Created September 22, 2012 22:19
sample fitnesse
package katoy;
public class Division {
private double numerator, denominator;
public void setNumerator(double numerator) {this.numerator = numerator;}
public void setDenominator(double denominator) {this.denominator = denominator;}
public double quotient() {return numerator/denominator;}
}