Skip to content

Instantly share code, notes, and snippets.

View phdoerfler's full-sized avatar

Philipp Dörfler phdoerfler

View GitHub Profile
cheatsheet do
title 'Mercurial' # Will be displayed by Dash in the docset list
docset_file_name 'mercurial' # Used for the filename of the docset
keyword 'hg' # Used as the initial search keyword (listed in Preferences > Docsets)
introduction 'Mercurial Cheatsheet' # Optional, can contain Markdown or HTML
# A cheat sheet must consist of categories
category do
id '.hgignore' # Must be unique and is used as title of the category
$ xiki
> Summary
The 'xiki' shell command is mostly meant to be called by programs
that want to interface with Xiki. But it is sometimes useful for
people to call it directly. Example usages:
$ xiki ip
$ xiki docs/faq
> Setting up your editor
@phdoerfler
phdoerfler / gist:4105954
Created November 18, 2012 15:54
Saves a snapshot of the entire scene in JavaFX
BufferedImage img = SwingFXUtils.fromFXImage(stage.getScene().snapshot(null), null);
ImageIO.write(img, "png", new File("snapshot.png"));
@phdoerfler
phdoerfler / gist:4245638
Created December 9, 2012 15:35
Three possible way to save JavaFX animations / timelines to XML
// Just three variants of how to save animations to XML for animating FXML scenes
// Variant 1
<timelines>
<timeline id="moveRight">
<at time="0s">
<property ofNode="meepButton" named="layoutX">0</property>
</at>
<at time="10s">
<property ofNode="meepButton" named="layoutX" tween="linear">200</property>
@phdoerfler
phdoerfler / sbt
Last active December 11, 2015 13:37
A launch script for SBT which warns if there are locally published libraries.
#!/usr/bin/env ruby
ivy = File.join(Dir.home, '/.ivy2/local')
local = Dir[File.join(ivy, '*/*/*')]
if not local.empty?
puts "\e[1m\e[33mFiles in IVY local:"
local.each do |d|
puts "- " + d.sub(ivy + '/', '').split('/').map { |s| '"' + s + '"' }.join(' % ')
end
package bugs;
import javafx.scene.control.ScrollPaneBuilder;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.AnchorPaneBuilder;
import javafx.scene.layout.StackPaneBuilder;
public class LookupJava {
public static void main(String[] args) {
AnchorPane p = AnchorPaneBuilder.create()
@phdoerfler
phdoerfler / gist:5212324
Created March 21, 2013 11:21
lookup with attached Scene and parent
package bugs;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.ScrollPaneBuilder;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.AnchorPaneBuilder;
import javafx.scene.layout.StackPaneBuilder;
import javafx.stage.Stage;
@phdoerfler
phdoerfler / gist:5240113
Created March 25, 2013 19:54
Example Output for sbtFX
// This FXML:
<?xml version="1.0" encoding="UTF-8"?>
<?import java.lang.*?>
<?import java.util.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.paint.*?>
<AnchorPane id="AnchorPane" prefHeight="400.0" prefWidth="600.0" xmlns:fx="http://javafx.com/fxml" fx:controller="org.fancy.Controller">
@phdoerfler
phdoerfler / gist:5258198
Created March 27, 2013 21:30
It compiles! ^.~
// Auto generated, changes will be overwritten
package org.fancy
import javafx.fxml.FXML
import javafx.scene.control.Button
object Controller {
@FXML
var meep: Button = ???
object GhettoValidation {
implicit class Optionator[A](val a: A) extends AnyVal {
def iff(f: => Boolean): Option[A] =
if (f) Some(a) else None
}
}