Skip to content

Instantly share code, notes, and snippets.

View daveray's full-sized avatar

Dave Ray daveray

View GitHub Profile
@daveray
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(FileContentImpl.java:189)
at cursive.index.PsiDependentIndexExtension$1$1.valAt(PsiDependentIndexExtension.java:61)
at cursive.index.PsiDependentIndexExtension$1$1.valAt(PsiDependentIndexExtension.java:51)
at clojure.lang.KeywordLookupSite$1.get(KeywordLookupSite.java:45)
at plugin.index.js$index_javascript.invoke(js.clj:196)
@daveray
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 '[com.netflix.hystrix.core :as hystrix])
@daveray
daveray / gist:1000703
Created May 31, 2011 15:39
setVisible
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
daveray / gist:1000729
Created May 31, 2011 15:47
seesaw setvisible
(frame :resizable? true
:content (vertical-panel
:id :panel
:items
[(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
daveray / seesaw-tests.txt
Created June 14, 2011 00:42
Seesaw Tests
Namespaces
seesaw.test.event
#'seesaw.event/unappend-listener
can remove a listener
#'seesaw.event/listen
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
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
daveray / pi.clj
Created June 23, 2011 02:54
Seesaw Ad Hoc StyleSheet
(ns pi.core
(:use seesaw.core))
(native!)
(def gap [:fill-h 5])
; Set up the structure of the ui, giving widgets classes and ids as needed.
(defn make-frame []
(frame
@daveray
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]
(show!
(frame
:title "@rippinrobr's Hugo Best Novel Database"
:on-close :exit
:size [500 :by 600]
@daveray
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
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 {
soar.rhsFunction({
name: "cmd",
execute: function(context, args) {
var cmd = "";
for(var i = 0; i < args.length; i++) {
cmd = cmd + args[i] + " ";