Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
I may be slow to respond.

argius argius

💭
I may be slow to respond.
View GitHub Profile
@argius
argius / App.java
Last active Apr 10, 2017
Javaでゲーム: 画面のスクロール Java8+JInput使用 (JavaFX未使用) http://argius.hatenablog.jp/entry/2017/04/10/100000
View App.java
package game;
import static game.App.*;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.util.ArrayList;
@argius
argius / ExampleOfGamepadWithJInput.java
Created Feb 26, 2016
ゲームパッド入力とキーボード入力を使って宇宙船からビームを発射する。(Java JInputサンプル)
View ExampleOfGamepadWithJInput.java
/*
* ゲームパッド入力とキーボード入力を使って宇宙船からビームを発射する。
*/
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.*;
import java.util.*;
import java.util.List;
import java.util.concurrent.ForkJoinPool;
import java.util.stream.*;
@argius
argius / NetworkAvailableChecker.java
Last active Mar 1, 2016
ネットワークが切断されたことをアラームで知らせるツール.java
View NetworkAvailableChecker.java
import java.awt.AWTException;
import java.awt.Image;
import java.awt.MenuItem;
import java.awt.PopupMenu;
import java.awt.SystemTray;
import java.awt.TrayIcon;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.IOException;
@argius
argius / Quiz.java
Created Dec 4, 2015
コマンドラインのQuizゲーム (Java 7 and later)
View Quiz.java
package quiz;
import java.io.IOException;
import java.io.PrintStream;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
@argius
argius / MemberDAO.java
Last active Nov 10, 2015
Java8版 簡易DAOサンプル
View MemberDAO.java
/*
* Java8版 簡易DAOサンプル
*/
import java.sql.*;
import java.util.*;
final class Member {
int id;
String name;
@argius
argius / App.java
Last active Aug 23, 2021
Calculator written in Java 8 with JavaFX 8 + SceneBuilder 2.0
View App.java
package net.argius.calculator;
import java.math.BigDecimal;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.control.Button;
@argius
argius / gist:91f74ea87e3bee10d1f1
Created Nov 7, 2014
pom.xml for JavaEE 6 and Tomcat7
View gist:91f74ea87e3bee10d1f1
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>net.argius</groupId>
<artifactId>webapp1</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>webapp1 Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
@argius
argius / index.html.jade
Last active Aug 29, 2015
Try to shorten pagination codes in Skinny 1.0.9
View index.html.jade
ul.pagination
li
- for (i <- (0 to totalPages + 1); p <- Seq(if (i == 0) (1, "&laquo;") else if (i == totalPages + 1) (totalPages, "&raquo;") else (i, i.toString)))
li
a(href={s.url(Controllers.members.indexUrl, "page" -> p._1)}) #{unescape(p._2)}
@argius
argius / ScaffoldFromDb.scala
Created Feb 27, 2014
( See comment ) ScaffoldFromDb runs Skinny Framework's Scaffold with infos extracted from existing database tables.
View ScaffoldFromDb.scala
/**
* ScaffoldFromDbTask - adapter of ScaffoldGenerator
*
* This task requires to add db setting files (application.conf) into classpath.
*/
object ScaffoldFromDb {
import skinny._
import skinny.task.generator._
import scalikejdbc._
@argius
argius / Lambda sample (Foo.java)
Last active Aug 22, 2017
Java8 Lambda and its disassembled bytecode by javap
View Lambda sample (Foo.java)
import java.util.function.BiFunction;
class Foo {
public static void main(String[] args) {
Foo o = new Foo();
BiFunction<Integer, Integer, Integer> ff1 = Foo::f1;
BiFunction<Integer, Integer, Integer> ff2 = o::f2;
BiFunction<Integer, Integer, Integer> ff3 = (x, y) -> x * y;
System.out.println(ff1.apply(3, 5)); // => 15
System.out.println(ff2.apply(4, 6)); // => 24
System.out.println(ff3.apply(5, 9)); // => 45