Skip to content

Instantly share code, notes, and snippets.

@ksky
ksky / api_challenge_lv1_jp.md
Last active August 29, 2015 14:03
Global API Challenge (http://www.globalapichallenge.com) LEVEL ONE 日本語訳(非公式)

Q1 OUT OF 10

APIとは何の略?

  • Accelerated Product Innovation
  • Agile Programming Initiative
  • Application Programming Interface
  • Application Procedural Interface

Q2 OUT OF 10

[
{
"location":{
"latitude":35.648804,
"longitude":139.712639,
"displayAddress":"東京都渋谷区広尾1-3-13 ハイネス恵比寿"
},
"storeNumber":201,
"name":"一風堂 恵比寿店",
"lateNight":true,
@ksky
ksky / annularEclipse.groovy
Created June 21, 2012 03:58
GroovyFX timeline sample
@Grab('org.codehaus.groovyfx:groovyfx:0.2')
import static groovyx.javafx.GroovyFX.start
start {
stage(visible: true) {
scene(width: 400, height: 400, fill: black) {
circle(centerX: 200, centerY: 200, radius: 110, fill: yellow) {
effect dropShadow(color: white, radius: 50)
}
moon = circle(centerX: 400, centerY: 0, radius: 100, fill: black)
@ksky
ksky / birdsAnim.groovy
Created June 21, 2012 03:51
GroovyFX transition sample
@Grab('org.codehaus.groovyfx:groovyfx:0.2')
import static groovyx.javafx.GroovyFX.start
start {
stage(visible: true) {
scene(width: 640, height: 480, fill: lightskyblue) {
// 緑の鳥:回転(周期2秒)しながらpathに沿って飛ぶ(周期4秒)
imageView {
image("file:green_bird.png", width: 80, height: 80)
@ksky
ksky / svgAnimation.groovy
Created June 15, 2012 09:48
SVG Animation Sample playing with GroovyFX
@Grab('org.codehaus.groovyfx:groovyfx:0.2')
import static groovyx.javafx.GroovyFX.start
svg = '''<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="400px" height="250px" viewBox="0 0 400 250" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1">
<rect id="rect" x="50" y="50" width="100" height="75" fill="red" opacity="0.0">
<animate attributeName="opacity" begin="0s" dur="0.5s" from="0.0" to="1.0" fill="freeze" repeatCount="1"/>
<animate attributeName="x" begin="1s" dur="5s" fill="freeze" calcMode="linear" repeatCount="1" keyTimes="0;0.2;0.4;0.6;0.8;1" values="50;250;50;250;50;250"/>
<animate attributeName="fill" begin="1.5s" dur="2.4s" fill="freeze" calcMode="linear" repeatCount="1" keyTimes="0;0.25;0.5;0.75;1" values="red;green;red;green;red"/>
@ksky
ksky / animation.groovy
Created June 13, 2012 07:58
GroovyFX Animation Sample (groovy port of gist:2917266)
// GroovyFX version of "JavaFX Animation Sample": https://gist.github.com/2917266
@Grab('org.codehaus.groovyfx:groovyfx:0.2')
import static groovyx.javafx.GroovyFX.start
start {
stage = stage {
scene(width: 400, height: 250) {
// --- >8 --- Cut here for GroovyFxPad --- >8 ---
root = group {
@ksky
ksky / lupinfx.groovy
Created December 3, 2011 14:31
GroovyFXでルパン風タイトル表示
import groovyx.javafx.*
import javafx.scene.text.Font
import javafx.scene.media.*
def sound1 = new AudioClip("ルパン風タイプ音.aif")
def sound2 = new AudioClip("ルパン風BGM音.aif")
String message = "プログラミングGROOVY"
int len = message.size()
@ksky
ksky / ball.groovy
Created November 13, 2011 16:15
Twitter and HTML5 content integration by GroovyFX
@Grab('org.twitter4j:twitter4j:2.2.5')
@Grab('org.twitter4j:twitter4j-stream:2.2.5')
import twitter4j.*
import groovyx.javafx.*
import javafx.scene.control.*
import javafx.scene.media.*
import javafx.application.Platform
final HOTWORD = /(?i)groovy/
@ksky
ksky / media.groovy
Created November 13, 2011 16:00
Playing movie by GroovyFX
import groovyx.javafx.*
GroovyFX.start {
def sg = new SceneGraphBuilder()
sg.stage(title: "MediaView Demo", width: 640, height: 380, visible: true) {
scene(fill: black) {
mview = mediaView(fitWidth: 640, fitHeight: 380) {
player(autoPlay: true, source: "<URL to movie file(.flv)>")
transition = parallelTransition {
@ksky
ksky / introfx.groovy
Created November 5, 2011 05:18
Self introduction by Google+ API and GroovyFX
import groovyx.javafx.*
key = '<YOUR Google+ API KEY HERE>'
uid = 110611905999186598367 // user ID
url = "https://www.googleapis.com/plus/v1/people/$uid?key=$key".toURL()
json = new groovy.json.JsonSlurper().parseText(url.text)
GroovyFX.start {
def sg = new SceneGraphBuilder()