Skip to content

Instantly share code, notes, and snippets.

@fumokmm
fumokmm / mass_data_table_by_jQuery.html
Last active August 30, 2015 13:25
jQueryで大量データを扱うテーブルのサンプル
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8">
<title>jQueryで大量データテーブル</title>
<style type="text/css">
.viewport {
position: relative;
background: blue;
overflow: auto;
<script type="text/javascript" src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
//$("#xxxx").click();
});
</script>
@fumokmm
fumokmm / file0.groovy
Created September 5, 2013 14:33
Groovyでn日前の日付を求める ref: http://qiita.com/fumokmm/items/94c6ed2f26803aab704e
def beforeN(int n) {
new Date() - n
}
// 例: 100日前
println beforeN(100)
import java.io.*;
import javax.xml.parsers.*;
import javax.xml.transform.*;
import javax.xml.transform.dom.*;
import javax.xml.transform.stream.*;
import org.w3c.dom.*;
@fumokmm
fumokmm / Markdown.groovy
Last active December 16, 2015 03:09
「GroovyでMarkdownパーサーを作ろう」 http://npnl.hatenablog.jp/entry/series/fumomarkdowng
class Markdown {
/** 見出し:Atx形式 */
String headerAtx(String md) {
def sharpSize = md.find(/^#+/).size()
if (sharpSize in 1..6) {
def tags = [ "<h${sharpSize}>",
"</h${sharpSize}>" ]
//def contents = md.replaceAll(/^#+\s*|\s*#+$/, '').trim()
def contents = md.replaceAll(/(?x) # enable whitespace and comments
^\#+ # 先頭からはじまるシャープ
String[] deal(int numPlayers, String deck) {
deck.toList().collate(numPlayers, false)
.transpose()*.join() ?: [''] * numPlayers
}
assert deal(3, '123123123') == ['111', '222', '333'] as String[]
assert deal(4, '123123123') == ['12', '23', '31', '12'] as String[]
assert deal(6, '012345012345012345') == ['000', '111', '222', '333', '444', '555'] as String[]
assert deal(4, '111122223333') == ['123', '123', '123', '123'] as String[]
assert deal(1, '012345012345012345') == ['012345012345012345'] as String[]
assert deal(6, '01234') == ['', '', '', '', '', ''] as String[]
@fumokmm
fumokmm / helloJLine.groovy
Last active December 10, 2015 22:38
JLine minimum sample in Groovy.
@GrabResolver(name='jline', root='http://jline.sourceforge.net/m2repo')
@Grab(group='jline', module='jline', version='0.9.9')
import jline.*
def prompt(ConsoleReader reader, String msg, Closure clos) {
while (true) {
def line = reader.readLine(msg)
if (line in [null, 'exit']) break
clos(line)
}
@fumokmm
fumokmm / CalcOperator.properties
Created December 9, 2012 17:26
動的プロパティ読み込みクラス in Groovy
plus={ a, b -> a + b }
minus={ a, b -> a - b }
multiply={ a, b -> a * b }
div={ a, b -> a / b }
@fumokmm
fumokmm / README.md
Created August 16, 2012 16:03
GroovyでJavaのpackage-info.javaを一括生成するスクリプト
@fumokmm
fumokmm / README.md
Created July 31, 2012 15:14
Integerに閏年判定メソッドを追加 in Groovy