This lives in the npm module oog
(https://npmjs.org/package/oog).
Running the ClojureScript Hello World example in node.js without creating a goog
global.
$ cljsc hello.cljs > hello.js
$ coffee test.coffee
Hello node.js
// fix a tsv with unescaped newlines | |
val lines = io.Source.fromFile(argv(0)).getLines | |
val header = lines.next() | |
val tabCount = header.count(_ == '\t') | |
println(header) | |
while (lines.hasNext) { |
require 'socket' | |
s = TCPSocket.new ARGV[0], 60128 | |
def hexify_command(cmd) | |
cmd = '!1' + cmd unless cmd.start_with? '!1' | |
"ISCP\x00\x00\x00\x10\x00\x00\x00#{(cmd.length + 1).chr}\x01\x00\x00\x00#{cmd}\x0D" | |
end | |
s.write hexify_command(ARGV[1]) |
fs = require 'fs' | |
class FileSampleSource | |
constructor: (filename) -> | |
@fd = fs.openSync filename, 'r' | |
# FIXME | |
@bytesPerSample = 1 | |
@channels = 2 | |
@offset = 44 |
user=> (try | |
#_=> (/ 1 0) | |
#_=> (catch Throwable t (throw (RuntimeException. t)))) | |
ArithmeticException Divide by zero clojure.lang.Numbers.divide (Numbers.java:156) | |
user=> (try | |
#_=> (/ 1 0) | |
#_=> (catch Throwable t (throw (RuntimeException.)))) | |
RuntimeException user/eval4065 (NO_SOURCE_FILE:2) |
colors = require 'colors' | |
targets = (randomWalkFunction('test.' + i) for i in [1..9]) | |
graph targets, maxDataPoints: 200, d3_colors: colors.brewer.Set3[11], lineWidth: 1.5, width: 1280, height: 720 |
fs = require 'fs' | |
_ = require 'underscore' | |
lead = require './dist/nodejs/node.js' | |
parser = lead.require 'graphite_parser' | |
dsl = lead.require 'dsl' | |
filename = process.argv[2] | |
s = fs.readFileSync filename, 'ascii' |
exposed_scope = {} | |
top_scope = null | |
push_scope = -> | |
top_scope = exposed_scope.__proto__ = Object.create exposed_scope.__proto__ | |
pop_scope = -> | |
top_scope = exposed_scope.__proto__ = exposed_scope.__proto__.__proto__ | |
with_scope = (fn) -> |
This lives in the npm module oog
(https://npmjs.org/package/oog).
Running the ClojureScript Hello World example in node.js without creating a goog
global.
$ cljsc hello.cljs > hello.js
$ coffee test.coffee
Hello node.js
# https://github.com/also/simple-check/tree/cljx | |
goo = require './goog' # https://gist.github.com/also/7189192 | |
goog = goo 'target/unoptimized/goog' | |
goog.load 'target/unoptimized.js' | |
cljs = goog.require 'cljs.core' | |
gen = goog.require 'simple_check.generators' | |
console.log cljs.clj__GT_js gen.sample gen.int$ | |
console.log cljs.clj__GT_js gen.sample gen.vector gen.string_ascii |
(ns riemann.transport.kafka | |
(:import java.util.concurrent.Executors | |
java.util.Properties | |
kafka.consumer.Consumer | |
kafka.consumer.ConsumerConfig | |
kafka.javaapi.consumer.ConsumerConnector) | |
(:use [riemann.service :only [Service ServiceEquiv]])) | |
(defn- consumer-properties | |
[opts] |