Skip to content

Instantly share code, notes, and snippets.

@fumokmm
fumokmm / mass_data_table_by_jQuery.html
Last active Aug 30, 2015
jQueryで大量データを扱うテーブルのサンプル
View mass_data_table_by_jQuery.html
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8">
<title>jQueryで大量データテーブル</title>
<style type="text/css">
.viewport {
position: relative;
background: blue;
overflow: auto;
View jQueryの読み込み
<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>
View file0.groovy
def beforeN(int n) {
new Date() - n
}
// 例: 100日前
println beforeN(100)
View XmlTest.java
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.*;
View Markdown.groovy
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
^\#+ # 先頭からはじまるシャープ
View trumpDistribution.groovy
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 Dec 10, 2015
JLine minimum sample in Groovy.
View helloJLine.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 Dec 9, 2012
動的プロパティ読み込みクラス in Groovy
View CalcOperator.properties
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 Aug 16, 2012
GroovyでJavaのpackage-info.javaを一括生成するスクリプト
@fumokmm
fumokmm / README.md
Created Jul 31, 2012
Integerに閏年判定メソッドを追加 in Groovy
View README.md
You can’t perform that action at this time.