Skip to content

Instantly share code, notes, and snippets.

View rboyd's full-sized avatar

Robert Boyd rboyd

  • Anarchist
  • Bentonville, AR
View GitHub Profile
@rboyd
rboyd / fressian-util.clj
Last active August 29, 2015 13:57
lazy-seq over fressian objects
(ns fressian-util
(:require [clojure.java.io :as io]
[clojure.data.fressian :as fress]))
(defn lazy-fressian-objects [file]
(letfn [(helper [rdr]
(lazy-seq
(if-let [is-avail (> (.available rdr) 0)]
(cons (fress/read-object (fress/create-reader rdr)) (helper rdr))
(do (.close rdr) nil))))]
We couldn’t find that file to show.
require 'rubygems'
require 'cmdparse'
require 'OpenMetaverse'
require 'OpenMetaverseTypes'
include OpenMetaverse
class SayCmd < CmdParse::Command
def initialize(client)
super('say', false)
require 'cmdparse'
class CommandLoader
def initialize(client)
@client = client
end
def loadCommands
cmd = CmdParse::CommandParser.new(false, true)
(def encoders (config-keys
(config-for :cars :license (fn [car-map]
(car-map :license)))))
(def decoders (config-keys
(config-for :cars :license (fn [value]
value))))
(def keys-config {:encode encoders :decode decoders})
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.rboyd</groupId>
<artifactId>test4</artifactId>
<version>1.0-SNAPSHOT</version>
<inceptionYear>2008</inceptionYear>
<properties>
<scala.version>2.7.0</scala.version>
</properties>
bobby-boyds-macbook-pro:test4 rboyd$ mvn package[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Unnamed - com.bluff:test4:jar:1.0-SNAPSHOT
[INFO] task-segment: [package]
[INFO] ------------------------------------------------------------------------
Downloading: file://Users/rboyd/work/akka-0.6/embedded-repo/sjson/json/sjson/0.3/sjson-0.3.pom
[INFO] Unable to find resource 'sjson.json:sjson:pom:0.3' in repository project.embedded.module (file://Users/rboyd/work/akka-0.6/embedded-repo)
Downloading: http://scala-tools.org/repo-releases/sjson/json/sjson/0.3/sjson-0.3.pom
[INFO] Unable to find resource 'sjson.json:sjson:pom:0.3' in repository scala-tools.org (http://scala-tools.org/repo-releases)
Downloading: http://repo1.maven.org/maven2/sjson/json/sjson/0.3/sjson-0.3.pom
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>sjson.json</groupId>
<artifactId>sjson</artifactId>
<version>0.3</version>
<packaging>jar</packaging>
</project>
bobby-boyds-macbook-pro:test4 rboyd$ mvn package
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Unnamed - com.bluff:test4:jar:1.0-SNAPSHOT
[INFO] task-segment: [package]
[INFO] ------------------------------------------------------------------------
[INFO] [enforcer:enforce {execution: enforce-java}]
[INFO] [resources:resources {execution: default-resources}]
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/rboyd/work/trash/test4/src/main/resources
scala> <foo thing={bar.map(el => Seq(Text(el)))} />
res9: scala.xml.Elem = <foo thing="bar"></foo>
scala> <foo thing={baz.map(el => Seq(Text(el)))} />
res10: scala.xml.Elem = <foo ></foo>
scala> bar
res11: Some[java.lang.String] = Some(bar)
scala> baz