This file contains hidden or 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
/* | |
ただFileSystemとして使うのは問題ないが、Grabでライブラリをロードするスクリプトの体で | |
jimfs:なスキームのURIを解決できるようにしたい場合はできなくはなかったが、見つけた方法はいいものではなかった | |
*/ | |
// versions | |
// Groovy 2.5.0 | |
// JVM 10 | |
@Grapes([ | |
@GrabConfig(systemClassLoader=true), | |
@Grab('com.google.jimfs:jimfs:1.1'), |
This file contains hidden or 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
configurations { | |
reactivestreams | |
rxjava2 | |
rxjava2_interop | |
} | |
dependencies { | |
reactivestreams 'org.reactivestreams:reactive-streams:1.0.1' | |
rxjava2 'io.reactivex.rxjava2:rxjava:2.1.5' | |
rxjava2_interop 'com.github.akarnokd:rxjava2-jdk9-interop:0.1.5' |
This file contains hidden or 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.util.concurrent.FutureTask | |
import java.util.concurrent.CompletableFuture | |
import java.util.concurrent.Callable | |
import java.util.concurrent.CancellationException | |
// 指定時間寝て、夢見SCOREを返す | |
int dream(int millis) { | |
try { | |
println "$millis ms 寝る..." | |
Thread.sleep(millis) |
This file contains hidden or 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.util.concurrent.CompletableFuture | |
import java.util.concurrent.FutureTask | |
import java.util.concurrent.Callable | |
def task = new FutureTask({ | |
println "runAsync: ${Thread.currentThread()}" | |
def i = 0 | |
for (; i < 5; ++i) { | |
println "count: $i" | |
Thread.sleep(200) |
This file contains hidden or 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
/** | |
* JavaFX Screen Capture with java.awt.Robot | |
* run: groovy javafx_screen-capture_with_awt-robot.groovy | |
*/ | |
import javafx.application.Application | |
import javafx.application.Platform | |
import javafx.embed.swing.SwingFXUtils | |
import javafx.geometry.Insets | |
import javafx.scene.Parent | |
import javafx.scene.Scene |
This file contains hidden or 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
// ==UserScript== | |
// @name <title> | |
// @namespace https://gist.github.com/am4dr/e403980f0c6788d7979a537923afb1d8 | |
// @version 0.0.1 | |
// @description <description> | |
// @author am4dr | |
// @updateURL https://gist.github.com/am4dr/e403980f0c6788d7979a537923afb1d8/raw/<name>.user.js | |
// @match <url *://*> | |
// @grant none | |
// ==/UserScript== |
This file contains hidden or 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
/* | |
* 次の時刻00.000秒ちょうどにページのvideoを再生開始する。 | |
* 対象が唯一のvideo要素であるページで実行可能。 | |
*/ | |
(function () { | |
const video = document.getElementsByTagName('video')[0]; | |
function delay_play() { | |
const thre = 200; | |
const now = new Date(); | |
const wait = (60 - (now.getSeconds())) * 1000 - now.getMilliseconds(); |
This file contains hidden or 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
/* | |
JavaFXでUNDECORATEDなウィンドウをドラッグで移動する | |
実行: groovy javafx_movable-undeco-window.groovy | |
*/ | |
import javafx.application.Application | |
import javafx.scene.Scene | |
import javafx.scene.control.Label | |
import javafx.scene.layout.Background | |
import javafx.scene.layout.BackgroundFill |
This file contains hidden or 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
/* | |
実行は groovy javafx_transparent-utility-window.groovy | |
Windows 10では期待した動作を確認済み | |
次の3点を満たすウィンドウをJavaFXで実現するサンプル | |
- タスクバーにアイコンを表示しない | |
- ウィンドウの装飾がない | |
- 背景が透明 | |
ウィンドウ装飾がないので |
This file contains hidden or 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
/* | |
JavaFX でアプリケーション外からのドラッグ・ドロップを処理する。 | |
Nodeに対してD&Dを受けつけるという設定を行うことでFileのリストを得られる。 | |
参考: | |
[Node (JavaFX 8)](http://docs.oracle.com/javase/jp/8/javafx/api/javafx/scene/Node.html#onDragDroppedProperty) | |
[DragEvent (JavaFX 8)](http://docs.oracle.com/javase/jp/8/javafx/api/javafx/scene/input/DragEvent.html) | |
[Clipboard (JavaFX 8)](http://docs.oracle.com/javase/jp/8/javafx/api/javafx/scene/input/Clipboard.html) | |
*/ | |
import javafx.application.Application | |
import javafx.event.EventHandler |
NewerOlder