Last active
August 13, 2017 22:38
-
-
Save dkozma/696baa31fe44052130bc9aef8512ebab to your computer and use it in GitHub Desktop.
Clojure->Chrome Inspector
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns inspect | |
(:require [cheshire.core :refer [generate-string]] | |
[clojure.java.io :as io]) | |
(:import (java.net Socket) | |
(def host "localhost") | |
(def port 9000) | |
(defn cinspect [data] | |
(with-open [sock (Socket. host port) | |
writer (io/writer sock)] | |
(->> data | |
generate-string | |
(.append writer) | |
(.flush)))) | |
(cinspect {:message "Hello!"}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var net = require('net') | |
var port = 9000 | |
var server = net.createServer(socket => { | |
let msg = '' | |
socket | |
.on('data', data => msg += data.toString()) | |
.on('close', () => { | |
console.clear() | |
console.log(JSON.parse(msg)) | |
msg = '' | |
}) | |
}) | |
server.listen(port, () => { | |
console.info("Server started on port:", port) | |
}) |
(clojure.inspector/inspect large-map)
is another option, providing a java based GUI to view data.
You may also want to look at https://github.com/Azel4231/dsui
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
One alternate approach, which I use, is to put together an interactive in-REPL data explorer for large, complex data structures. The one I hacked together is currently oriented toward internal data at my work, but at some point I hope to generalize & open-source it.
Tossing that out just as another option, but I really like this one too & may end up using it. Thanks!