Skip to content

Instantly share code, notes, and snippets.

@satyagraha
satyagraha / gist:4999843
Created February 20, 2013 21:34
Why do I get: "type mismatch; found : com.wierd.FFTest.Dimension required: org.openqa.selenium.Dimension"
package com.wierd
import org.openqa.selenium.Dimension
import org.scalatest.selenium.Firefox
object FFTest extends Firefox {
def main(args: Array[String]): Unit = {
webDriver.manage.window.setSize(new Dimension(1200, 800))
@satyagraha
satyagraha / ITunesApp.scala
Created September 28, 2013 13:12
Why does this app seem to block at line 42?
package org.satyagraga.dispatch.evaluation
import dispatch._, Defaults._
import org.json4s._
import org.json4s.native.JsonMethods._
case class ITune(trackId: Int, trackName: String)
object ITunesApp {
package org.test
import scalax.collection.immutable.Graph
import scalax.collection.GraphPredef._
import scalax.collection.GraphEdge._
object SampleGraph {
case class MyNode(name: String)
@satyagraha
satyagraha / gist:11172010
Created April 22, 2014 09:37
Gradle-Graphviz 1
task showConfigurations << {
new File("graph/configurations.dot").withWriter { out ->
out.println "digraph configurations {"
out.println "rankdir=BT;"
configurations.all { con ->
out.println "${con.name} [shape=box];"
con.extendsFrom.each { ext ->
out.println "${con.name} -> ${ext.name};"
}
}
@satyagraha
satyagraha / gist:11197929
Created April 22, 2014 23:31
Gradle-Graphml 1
task showConfigurationsGml << {
new File("graph/configurations.graphml").withWriter { out ->
builder = new groovy.xml.StreamingMarkupBuilder()
builder.encoding = 'UTF-8'
xml = builder.bind {
mkp.xmlDeclaration()
mkp.declareNamespace('': 'http://graphml.graphdrawing.org/xmlns')
mkp.declareNamespace('y': 'http://www.yworks.com/xml/graphml')
graphml(edgedefault: 'directed') {
key('for': 'node', id: 'd1', 'yfiles.type': 'nodegraphics')
package org.mine
import groovy.xml.StreamingMarkupBuilder
import groovy.xml.XmlUtil
import java.io.File;
import java.io.IOException;
import java.util.Set;
import org.gradle.api.Project;
import org.gradle.api.artifacts.Configuration;
@satyagraha
satyagraha / HelloWorld4
Created November 7, 2014 22:58
HelloWorld4
package org.mydemo.jgraphx;
import java.awt.BorderLayout;
import javax.swing.JFrame;
import javax.swing.SwingConstants;
import com.mxgraph.layout.mxIGraphLayout;
import com.mxgraph.layout.hierarchical.mxHierarchicalLayout;
import com.mxgraph.swing.mxGraphComponent;
@satyagraha
satyagraha / AllDirectionsHierarchicalLayout
Created November 7, 2014 23:00
AllDirectionsHierarchicalLayout
package org.mydemo.jgraphx;
import java.util.Collection;
import java.util.List;
import javax.swing.SwingConstants;
import com.mxgraph.layout.hierarchical.mxHierarchicalLayout;
import com.mxgraph.model.mxCell;
import com.mxgraph.model.mxGeometry;
@satyagraha
satyagraha / HelloWorld5
Created November 13, 2014 08:59
HelloWorld5
package org.mydemo.jgraphx;
import java.awt.BorderLayout;
import java.util.HashMap;
import java.util.Map;
import javax.swing.JFrame;
import javax.swing.SwingConstants;
import com.mxgraph.layout.mxIGraphLayout;
@satyagraha
satyagraha / X11Colors
Created November 13, 2014 11:03
X11Colors
package org.swing
import java.awt.Color
/**
* A utility object to provide Java Color objects from the X11 namespace.
*
* @see http://en.wikipedia.org/wiki/X11_color_names
* @author satyagraha
* @license MIT