Skip to content

Instantly share code, notes, and snippets.

@giuniu
giuniu / ExSeq.scala
Created February 28, 2012 03:26 — forked from gakuzzzz/ExSeq.scala
mapBetween関数 trait版
trait ExSeq[+A] {
self: Seq[A] =>
def mapBetween[B](f:(A,A)=>B): Iterator[B] = {
sliding(2).map(s=>f(s(0),s(1)))
}
}
object ExSeq {
@giuniu
giuniu / 修正前.xml
Created March 3, 2012 14:07
homebrew.mxcl.jenkins.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>homebrew.mxcl.jenkins</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/java</string>
<string>-jar</string>
@giuniu
giuniu / Tuples.java
Created March 7, 2012 06:24
tupleっぽいものをJavaで実装する
import java.lang.reflect.Field;
import java.util.Date;
public final class Tuples {
public static void main(String[] args) {
Tuple3<Integer, String, Date> tpl = Tuples.get(1, "a", new Date());
System.out.println(tpl._1);
System.out.println(tpl);
}
@giuniu
giuniu / gist:3208264
Created July 30, 2012 16:36 — forked from skRyo/gist:3196957
教えてエライ人2
interface Debugprintable {
enum ErrStatus {
NO_ERROR(0), FILE_ERROR(1), MEMORY_ERROR(2);
private final int statusCode;
private ErrStatus(int statusCode) {
this.statusCode = statusCode;
}
@Override
public String toString() {
return Integer.toString(statusCode);
@giuniu
giuniu / View.java
Created August 8, 2012 01:23 — forked from skRyo/View.java
教えてエライ人3
package com.example;
public class Control {
public static void main(String[] args) {
Model.Rectangle r1 = new Model.Rectangle(1, 2, 3, 4);
Model.Rectangle r2 = new Model.Rectangle(2, 3, 5, 5);
new Control().execute(r1, r2);
}
@giuniu
giuniu / StepCounter.java
Created October 10, 2012 22:22
Javaコードのステップカウンター
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.Reader;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public enum StepCounter {
INSTANCE;
@giuniu
giuniu / AVLTree.java
Created December 14, 2012 10:31
「アルゴリズムを学ぼう」よりAVL木の実装。
import static java.lang.Math.max;
import static java.lang.Math.min;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
public class AVLTree<T extends Comparable<? super T>> {
private Node root;