Skip to content

Instantly share code, notes, and snippets.

@GrabResolver('http://repo.gradle.org/gradle/libs/')
@Grab('org.gradle:gradle-tooling-api:1.0')
import org.gradle.tooling.GradleConnector
import org.gradle.tooling.ProgressListener
import org.gradle.tooling.model.GradleProject
import org.gradle.tooling.model.GradleTask
import groovy.swing.*
import groovy.ui.SystemOutputInterceptor;
import javax.swing.*
import javax.swing.tree.*
import javafx.application.Application
import javafx.event.ActionEvent
import javafx.geometry.Pos
import javafx.scene.Scene
import javafx.scene.control.Button
import javafx.scene.control.Label
import javafx.scene.layout.VBox
import javafx.stage.Stage
import kotlinfx.*
@mike-neck
mike-neck / UsaMimi.groovy
Created July 11, 2012 08:47
Closureを受けた変数名を取ってくる / retrieve a variable name for Closure object
class UsaMimi {
def kaworiChan = {println 'I love you!'}
def kyon = {Closure closure ->
def map = closure.delegate.properties.collectEntries {
[it.value, it.key]
}
def name = map[closure]
print "${name} "
closure ()
}
@fumokmm
fumokmm / FactoryTest.java
Created July 3, 2012 21:55
Javaで型トークンを利用したファクトリクラス
package fumokmm.test.factory;
import java.util.*;
import org.junit.*;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;
public class FactoryTest {
static abstract class Alphabet {
@STAR-ZERO
STAR-ZERO / FontFitTextView.java
Created June 15, 2012 03:18
【Android】横幅に合わせてテキストサイズを調整するTextView
import android.content.Context;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.widget.TextView;
/**
* サイズ自動調整TextView
*
*/
griffon install-plugin http://artifacts.griffon-framework.org/repository/plugins/installer/0.6/griffon-installer-0.6.zip
griffon install-plugin http://artifacts.griffon-framework.org/repository/plugins/swingx-builder/0.6/griffon-swingx-builder-0.6.zip
griffon install-plugin http://artifacts.griffon-framework.org/repository/plugins/dialogs/0.3/griffon-dialogs-0.3.zip
griffon install-plugin http://artifacts.griffon-framework.org/repository/plugins/i18n-support/0.2/griffon-i18n-support-0.2.zip
griffon install-plugin http://artifacts.griffon-framework.org/repository/plugins/miglayout/0.4/griffon-miglayout-0.4.zip
griffon install-plugin http://artifacts.griffon-framework.org/repository/plugins/actions/0.4/griffon-actions-0.4.zip
griffon install-plugin http://artifacts.griffon-framework.org/repository/plugins/jide-builder/0.7/griffon-jide-builder-0.7.zip
griffon install-plugin http://artifacts.griffon-framework.org/repository/plugins/syntaxtext/0.2/griffon-syntaxtext-0.2.zip
griffon install-plugin http://artifacts.
@goofmint
goofmint / gist:2817307
Created May 28, 2012 04:57
JSGL demo
var gl = new GL.Context( w, h );
gl.enable( GL.TEXTURE_2D );
gl.enable( GL.DEPTH_TEST );
gl.clearColor( 0.0, 0.0, 0.0, 1.0 );
gl.clearDepth( 1.0 );
// Load grass texture
@mike-neck
mike-neck / count.groovy
Created May 24, 2012 00:45
副作用のない並行プログラミング
import static groovyx.gpars.GParsPool.*
withPool(3) {
(1..20).parallel.map {
[
duo : it % 2 == 0? 1 : 0,
tri : it % 3 == 0? 1 : 0,
cinq : it % 5 == 0? 1 : 0
]
}.reduce { a, b ->
@rirakkumya
rirakkumya / build.sbt
Created April 18, 2012 02:12
iTextとscala-ioでpdfを出力しちゃうコード
libraryDependencies += "com.github.scala-incubator.io" %% "scala-io-core" % "0.3.0"
libraryDependencies += "com.github.scala-incubator.io" %% "scala-io-file" % "0.3.0"
@tamtam180
tamtam180 / gist:2341752
Created April 9, 2012 05:49
AvocadoDBのJavaClientのサンプルコード。こんな感じのものになります。
/*
* Copyright (C) 2012 tamtam180
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software