Skip to content

Instantly share code, notes, and snippets.

View daveray's full-sized avatar

Dave Ray daveray

View GitHub Profile
daveray / cursive.txt
Created July 24, 2014 23:48
Cursive Error
Since upgrading to Cursive 0.1.30 I get errors like this at startup. Intellij 13.1.4.
Error while indexing /.../.gradle/caches/modules-2/files-2.1/... path to file ....js
To reindex this file IDEA has to be restarted: Cannot obtain text for binary file type : UNKNOWN
com.intellij.util.indexing.FileContentImpl$IllegalDataException: Cannot obtain text for binary file type : UNKNOWN
at com.intellij.util.indexing.FileContentImpl.getContentAsText(
at cursive.index.PsiDependentIndexExtension$1$1.valAt(
at cursive.index.PsiDependentIndexExtension$1$1.valAt(
at clojure.lang.KeywordLookupSite$1.get(
at plugin.index.js$index_javascript.invoke(js.clj:196)
daveray / hystrix-clj-snippets.clj
Last active August 29, 2015 14:04
hystrix clj snippets
(def user-prefs
{:type :command
:group-key :Cassandra
:command-key :GetUserPreferences
:run-fn (fn [user-id] ... do request ...)
:fallback-fn (fn [user-id] { ... default prefs ...})
:cache-key-fn (fn [user-id] (str user-id)) })
(require '[ :as hystrix])
daveray / gist:1000703
Created May 31, 2011 15:39
import java.awt.BorderLayout;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class VisibleButton {
daveray / gist:1000729
Created May 31, 2011 15:47
seesaw setvisible
(frame :resizable? true
:content (vertical-panel
:id :panel
[(button :text "show button 2"
:listen [:action (fn [e]
(let [btn (select (to-frame e) [:#btn])]
(.setVisible btn true)))])
(doto (button :id :btn :text "here I am") (.setVisible false))]))
daveray / seesaw-tests.txt
Created June 14, 2011 00:42
Seesaw Tests
can remove a listener
can install a mouse-clicked listener
returns a function that will remove the installed listener
can install two mouse-clicked listeners
can install a document listener
can register for a class of events
daveray / gist:1040586
Created June 22, 2011 17:17
AWT ScrollPane with Seesaw
(defn heavy-scrollable [target]
(doto (java.awt.ScrollPanel.)
(.add target)))
(show! (frame :content (heavy-scrollable (... make a PApplet))))
daveray / pi.clj
Created June 23, 2011 02:54
Seesaw Ad Hoc StyleSheet
(ns pi.core
(:use seesaw.core))
(def gap [:fill-h 5])
; Set up the structure of the ui, giving widgets classes and ids as needed.
(defn make-frame []
daveray / main_view.clj
Created June 28, 2011 00:01
Hugo in Seeesaw
(ns hugo.views.main-view
(:use hugo.db.sqlite)
(:use [seesaw core color]))
(defn create-home-view [data]
:title "@rippinrobr's Hugo Best Novel Database"
:on-close :exit
:size [500 :by 600]
daveray / async.clj
Created July 10, 2011 01:34
Cancelable Asyn
(defprotocol Async
(run-async* [this continue])
(cancel-async* [this]))
(defn await-event
"Awaits the given event on the given target asynchronuously. Passes on the
event to the continuation."
[target event]
(let [remove-fn (promise)]
(reify Async
daveray / test.soar
Created August 2, 2011 12:33
Emulating CSoar's 'cmd' function in JSoar
# Emulating CSoar's cmd function in JSoar
# Install a fake "cmd" RHS function.
script javascript {
name: "cmd",
execute: function(context, args) {
var cmd = "";
for(var i = 0; i < args.length; i++) {
cmd = cmd + args[i] + " ";