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
    
  
  
    
  | object x { | |
| // stream a sql query | |
| def sql( str:String ):Stream[ResultSet] = withStatement { s => | |
| val rs = s executeQuery str | |
| new Iterator[ResultSet] { def hasNext = rs.next ; def next = rs }.toStream | |
| } | |
| // loan a sql statement | 
  
    
      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
    
  
  
    
  | trait ReflectionSugars{ | |
| import scala.reflect.runtime.{universe => ru} | |
| private lazy val universeMirror = ru.runtimeMirror(getClass.getClassLoader) | |
| def companionOf[T](implicit tt: ru.TypeTag[T]) = { | |
| val companionMirror = universeMirror.reflectModule(ru.typeOf[T].typeSymbol.companionSymbol.asModule) | |
| companionMirror.instance | |
| } | |
| } | 
  
    
      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
    
  
  
    
  | ; A REPL-based, annotated Seesaw tutorial | |
| ; Please visit https://github.com/daveray/seesaw for more info | |
| ; | |
| ; This is a very basic intro to Seesaw, a Clojure UI toolkit. It covers | |
| ; Seesaw's basic features and philosophy, but only scratches the surface | |
| ; of what's available. It only assumes knowledge of Clojure. No Swing or | |
| ; Java experience is needed. | |
| ; | |
| ; This material was first presented in a talk at @CraftsmanGuild in | |
| ; Ann Arbor, MI. | 
  
    
      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
    
  
  
    
  | ; nREPL 0.1.7-preview | |
| user> (use 'seesaw.core) | |
| nil | |
| user> (def myframe (frame :title "Hello" :on-close :exit)) | |
| #'user/myframe | |
| user> (import com.mxgraph.view.mxGraph) | |
| com.mxgraph.view.mxGraph | |
| user> (def mygraph (mxGraph.)) | |
| #'user/mygraph | |
| user> (defn display [content] | 
  
    
      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 async-tut1.core | |
| (:require-macros [cljs.core.async.macros :refer [go]]) | |
| (:require [goog.dom :as dom] | |
| [goog.events :as events] | |
| [cljs.core.async :refer [<! put! chan]]) | |
| (:import [goog.net Jsonp] | |
| [goog Uri])) | |
| (def wiki-search-url | |
| "http://en.wikipedia.org/w/api.php?action=opensearch&format=json&search=") | 
  
    
      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
    
  
  
    
  | ;mapdb.clj | |
| (ns db.mapdb | |
| (:use | |
| [clojure.contrib.duck-streams :only (reader)] | |
| [clojure.java.io :only (writer)] | |
| [clojure.string :only (split)] | |
| [clojure.contrib.server-socket :only (create-server close-server)])) | |
| (def database-file "/Users/hideshi/Dev/Clojure/db/dbfile") | 
  
    
      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 busy-cursor.core | |
| (:use seesaw.core)) | |
| (defn long-running-task | |
| [] | |
| (Thread/sleep 5000) | |
| "The result") | |
| (defn run-task-with-busy-cursor | |
| [c] | 
  
    
      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 table-test.core | |
| (:use [seesaw core table swingx])) | |
| ; A predicate that decides whether a row should be highlighted | |
| ; adapter is an instance of JXTable.TableAdapter | |
| ; http://projects.joshy.org/projects/painterreview/swingx/org/jdesktop/swingx/JXTable.TableAdapter.html | |
| (defn hl-predicate [renderer adapter] | |
| ; Highligh all rows where :age is over thirty | |
| (> (.getValueAt adapter (.row adapter) 0) 30)) | 
  
    
      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 seesaw.async | |
| (:use [seesaw core])) | |
| ; see http://dotnetslackers.com/articles/net/Programming-user-interfaces-using-f-sharp-workflows.aspx#1478 | |
| (defmacro async | |
| "Macro that executes an async call (the first form), ignores its result, and the | |
| executes the body normally." | |
| [async-call & body] | |
| `(~@(apply list (first async-call) `(fn [& args#] ~@body) (rest async-call)))) | 
  
    
      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
    
  
  
    
  | ;; Generating static HTML using Clojure macros | |
| ;; It is possible to write a DSL in Clojure that generates HTML markup without the need to write a separate parser and compiler (e.g. HAML). | |
| ;; Our aim here would be to write code that converts the following Clojure code into the HTML below it | |
| ;; (html | |
| ;; (head) | |
| ;; (body | |
| ;; (h1 "An example") | 
OlderNewer