Skip to content

Instantly share code, notes, and snippets.

@jobez
jobez / private.clj
Created January 1, 2016 06:38 — forked from egamble/private.clj
Two ways to call private methods in Clojure.
;; This fn allows calling any method, as long as it's the first with that name in getDeclaredMethods().
;; Works even when the arguments are primitive types.
(defn call-method
[obj method-name & args]
(let [m (first (filter (fn [x] (.. x getName (equals method-name)))
(.. obj getClass getDeclaredMethods)))]
(. m (setAccessible true))
(. m (invoke obj (into-array Object args)))))
(defproject saphograph "0.1.0"
:description "mentat network"
:url ""
:dependencies [[org.clojure/clojure "1.5.1"]
[org.clojure/clojurescript "0.0-2197"]]
:node-dependencies []
:plugins [[lein-npm "0.4.0"]
[lein-cljsbuild "1.0.3"]]
:hooks [leiningen.cljsbuild]
:cljsbuild {
@jobez
jobez / core.cljs
Last active August 29, 2015 13:56
(ns select.core
(:require [om.core :as om :include-macros true]
[om.dom :as dom :include-macros true])
(:import [goog.ui IdGenerator] ;; unique id goodness
))
(defn guid []
(.getNextUniqueId (.getInstance IdGenerator)))
(enable-console-print!)