Skip to content

Instantly share code, notes, and snippets.

@devijvers
devijvers / ExampleUsage.js
Last active August 29, 2015 14:06
required(): hack the node.js require cache for fun and profit
require("coffee-script/register");
required = require("./required.coffee");
_ = require("lodash");
// require("underscore") will now work in every module
required("underscore", _);
@devijvers
devijvers / Console output:
Last active December 30, 2015 11:28
Discover the properties and signals of an arbitrary GStreamer element with GStreamer-java 1.5.
name (java.lang.String) (RW)
The name of the object
current-level-buffers (java.lang.Integer) (RO)
Current number of buffers in the queue
current-level-bytes (java.lang.Integer) (RO)
Current amount of data in the queue (bytes)
current-level-time (java.lang.Long) (RO)
Current amount of data in the queue (in ns)
max-size-buffers (java.lang.Integer) (RW)
Max. number of buffers in the queue (0=disable)
(use 'clojure.core.logic)
(use 'clojure.core.logic.protocols)
(defn pluso [t1 t2 s]
(fn goal [a]
(let [args (map (partial walk a) [t1 t2 s])
fresh? (map lvar? args)
ground? (map not fresh?)
[t1 t2 s] args]
(cond
(defn pluso [t1 t2 s]
(fn goal [a]
(let [args (map (partial walk a) [t1 t2 s])
fresh? (map lvar? args)
ground? (map not fresh?)]
(cond
(= [true true true] ground?) (if (= s (+ t1 t2)) a nil)
(= [true true false] ground?) (unify a s (+ t1 t2))
(= [true false true] ground?) (unify a t2 (- s t1))
(= [false true true] ground?) (unify a t1 (- s t2))