Skip to content

Instantly share code, notes, and snippets.

@tarchan
tarchan / ircbot
Last active January 2, 2016 16:29
irc client idea
IRCClient bot = new IRCClient(config.json);
bot.addServer(name, host, port, nick, user, real, encoding, tls, rooms);
bot.addListener("join", new IRCListener() {
handle(IRCMessage msg) {
String line = msg.read();
msg.send("hello!");
}
}):
IRCNameManager nameManager = new IRCNameManager();
nameManager.addListener(new IRCListener(){
public static final DateTimeFormatter TIME_PATTERN = DateTimeFormatter.ofPattern("HHmm");
public BigDecimal getRealKosu() {
LocalTime start = LocalTime.parse(strTime, TIME_PATTERN);
LocalTime end = LocalTime.parse(endTime, TIME_PATTERN);
LocalTime rest = LocalTime.parse(restTime, TIME_PATTERN);
Duration du = Duration.between(start, end);
Duration du2 = Duration.between(LocalTime.MIN, rest);
Duration du3 = du.minus(du2);
return new BigDecimal(du3.toMinutes() / 60.0);
// 月オブジェクトを取得
YearMonth currentMonth = YearMonth.now();
YearMonth backMonth = currentMonth.minusMonths(1);
YearMonth nextMonth = currentMonth.plusMonths(1);
// 日オブジェクトを取得
LocalDate firstDay = currentMonth.atDay(1);
LocalDate endDay = currentMonth.atEndOfMonth();
LocalDate endDay2 = currentMonth.atDay(currentMonth.lengthOfMonth());
LocalTime a = LocalTime.parse("09:00");
LocalTime b = LocalTime.parse("17:00");
Duration c = Duration.between(LocalTime.MIN, LocalTime.parse("01:00"));
Duration d = Duration.between(a, b).minus(c);
Dim a = Date.Parse("09:00")
Dim b = Date.Parse("17:00")
Dim c = Date.Parse("01:00").TimeOfDay
Dim d = b - a - c
@tarchan
tarchan / keyCombination.java
Created July 2, 2014 08:44
JavaFXでショートカットキーを設定する ref: http://qiita.com/tarchan@github/items/c45333fd987402f6307d
KeyCombination copyKey = KeyCombination.valueOf("Shortcut+c");
copyMenu.setAccelerator(copyKey);