This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CountDownLatch | |
def initialize(count) | |
raise ArgumentError, 'count < 0' if count < 0 | |
@count = count | |
@lock = Monitor.new | |
@condition = @lock.new_cond | |
end | |
def count_down | |
@lock.synchronize do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Currency { | |
public static enum Type { | |
JPY, USD, EUR, | |
} | |
private Type type; | |
private double rate; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
``` | |
irb(main):001:0> def hoge(a=1, b, c=3) a+b+c end | |
SyntaxError: (irb):1: syntax error, unexpected '=', expecting ')' | |
def hoge(a=1, b, c=3) a+b+c end | |
^ | |
from /Users/shinichi/.rbenv/versions/2.2.3/bin/irb:11:in `<main>' | |
irb(main):002:0> def hoge(b, a=1, c=3) a+b+c end | |
=> :hoge | |
irb(main):003:0> hoge 100 | |
=> 104 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.time.OffsetDateTime; | |
import java.time.format.DateTimeFormatter; | |
public class 日本人 { | |
protected final String name; | |
protected final OffsetDateTime birthdate; | |
public 日本人(String name, String birthdate) { | |
this.name = name; | |
// 2011-12-03T00:00:00+09:00 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public abstract class Parent { | |
public abstract Number someMethod(); | |
} | |
public class Child extends Parent { | |
@Override | |
@Sample | |
public Integer someMethod() { | |
return 1; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package snippet; | |
import java.io.FileOutputStream; | |
import java.util.List; | |
import org.apache.poi.ss.usermodel.CellStyle; | |
import org.apache.poi.ss.usermodel.IndexedColors; | |
import org.apache.poi.xssf.usermodel.XSSFCell; | |
import org.apache.poi.xssf.usermodel.XSSFCellStyle; | |
import org.apache.poi.xssf.usermodel.XSSFFont; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"time" | |
) | |
type Fetcher interface { | |
// Fetch returns the body of URL and | |
// a slice of URLs found on that page. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"time" | |
) | |
func putChannel(c chan int, count int) { | |
for i := 0; i < count; i++ { | |
c <- i |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bytes" | |
"io" | |
"os" | |
"strings" | |
) | |
type rot13Reader struct { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"encoding/json" | |
"fmt" | |
"net/http" | |
) | |
type String string |