Skip to content

Instantly share code, notes, and snippets.

@satyagraha
satyagraha / CirceTransformApp.scala
Created October 20, 2023 14:02
Circe Transform App
package example
import io.circe._
import io.circe.parser._
import io.circe.optics.JsonOptics._
import monocle.function.Plated
object CirceTransformApp {
def main(args: Array[String]): Unit = {
/**
* System configuration for Angular samples
* Adjust as necessary for your application needs.
*/
(function (global) {
System.config({
paths: {
// paths serve as alias
'npm:': 'node_modules/'
},
package my.cats
import cats.Semigroup
import cats.data.Validated
import cats.syntax.CartesianBuilder
import cats.syntax.cartesian._
import scala.util.control.NonFatal
package org.shape
object TypeEqualityChecks {
trait Bool {
type not <: Bool
}
trait True extends Bool {
type not = False
}
@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
@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 / 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 / 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;
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 / 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')