- Should make specifying keybindings externally easy, through resources.
- Should be easy like
(listen)
- Should be consistent with rest of event system.
This file contains hidden or 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
user=> (proxy [javax.swing.JPanel] [] | |
(paintComponent [^java.awt.Graphics g] | |
(let [^javax.swing.JPanel this this] | |
(proxy-super paintComponent g)) | |
(.fillRect g 100 100 10 10))) | |
Reflection warning, NO_SOURCE_PATH:27 - call to paintComponent can't be resolved. | |
#<JPanel$0 user.proxy$javax.swing.JPanel$0[,0,0,0x0,invalid,layout=java.awt.FlowLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=9,maximumSize=,minimumSize=,preferredSize=]> |
This file contains hidden or 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
(use 'seesaw.core) | |
(use 'seesaw.chooser) | |
(def open-action | |
(action :name "Open" :key "menu O" | |
:handler | |
(fn [e] | |
(if-let [f (choose-file)] | |
(text! (select (to-root e) [:#my-text]) f))))) |
This file contains hidden or 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
; http://www.graphviz.org/content/ER | |
(ns dorothy.examples.er | |
(:use dorothy.core)) | |
(defn -main [] | |
(-> | |
(graph :ER [ | |
{:rankdir :LR} | |
[:node {:shape :box}] |
This file contains hidden or 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 match.pojo | |
(:use [match.core :only [IMatchLookup val-at* match]])) | |
(set! *warn-on-reflection* true) | |
(defmacro pojo-match | |
"Generate an implementation of match.core/IMatchLookup for the given Java class. | |
Keys are mapped like this: | |
isVisible -> :visible? |
This file contains hidden or 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
; If I'm doing something completely bogus here, let me know :) | |
user=> (use 'match.core) | |
nil | |
user=> | |
(extend-type java.awt.Color | |
IMatchLookup | |
(val-at* [this k not-found] | |
(get (bean this) k not-found))) | |
nil |
This file contains hidden or 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 vim.core) | |
(defn async* [f] | |
(future | |
(let [result (with-out-str | |
(try | |
(println (f)) | |
(catch Exception e | |
(.printStackTrace e | |
(java.io.PrintWriter. *out*))))) ] |
This file contains hidden or 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
; First with reset! (don't do this!) | |
user=> (defn id-generator [] | |
(let [id (atom 0)] | |
(fn [] | |
(reset! id (inc @id))))) | |
#'user/id-generator | |
user=> (def g (id-generator)) | |
#'user/g | |
user=> (doseq [i (range 10)] | |
(future |
This file contains hidden or 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
These are very Java-centric, but honestly, if you're not doing Java why would you want to use Eclipse? :) | |
Replace `ctrl` with `cmd` as needed. The translation to Mac is a little arbitrary. | |
* ctrl-. (period): Jump to next warning or error | |
* ctrl-1: Show quick-fix menu (great in conjunction with ctrl-.) | |
* ctrl-3: "smart" navigation. Type name of something (file, view, perspective, etc) to go to it. | |
* ctrl-D: delete current line | |
* ctrl-e: switch editor. Also try ctrl-F6 | |
* ctrl-F7: switch between views |
This file contains hidden or 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
# (println (map #(* % %) (range 10))) becomes: | |
x = Familiar.with do | |
map fn {|x| x * x}, range(10) | |
end | |
Familiar.println x | |
=> (0 1 4 9 16 25 36 49 64 81) |