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
| (defn get-clipboard [] | |
| (.getSystemClipboard (java.awt.Toolkit/getDefaultToolkit))) | |
| (defn slurp-clipboard [] | |
| (try | |
| (.getTransferData (.getContents (get-clipboard) nil) (java.awt.datatransfer.DataFlavor/stringFlavor)) | |
| (catch java.lang.NullPointerException e nil))) | |
| (defn spit-clipboard [text] | |
| (.setContents (get-clipboard) (java.awt.datatransfer.StringSelection. text) 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 three.demo) | |
| (def camera (THREE.Camera. 75 (/ window/innerWidth | |
| window/innerHeight) 1 10000)) | |
| (set! (.z (.position camera)) 1000) | |
| (def scene (THREE.Scene.)) | |
| (def geometry (THREE.CubeGeometry. 200 200 200)) | |
| (def obj (js/Object.)) | |
| (set! (.color obj) 0xff0000) | |
| (set! (.wireframe obj) true) | |
| (def material (THREE.MeshBasicMaterial. obj)) |
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
| cljs.closure> (load-externs {}) | |
| [#<JSSourceFile externs.zip//es3.js> #<JSSourceFile externs.zip//es5.js> #<JSSourceFile externs.zip//w3c_event.js> #<JSSourceFile externs.zip//w3c_event3.js> #<JSSourceFile externs.zip//gecko_event.js> #<JSSourceFile externs.zip//ie_event.js> #<JSSourceFile externs.zip//webkit_event.js> #<JSSourceFile externs.zip//w3c_dom1.js> #<JSSourceFile externs.zip//w3c_dom2.js> #<JSSourceFile externs.zip//w3c_dom3.js> #<JSSourceFile externs.zip//gecko_dom.js> #<JSSourceFile externs.zip//ie_dom.js> #<JSSourceFile externs.zip//webkit_dom.js> #<JSSourceFile externs.zip//w3c_css.js> #<JSSourceFile externs.zip//gecko_css.js> #<JSSourceFile externs.zip//ie_css.js> #<JSSourceFile externs.zip//webkit_css.js> #<JSSourceFile externs.zip//google.js> #<JSSourceFile externs.zip//deprecated.js> #<JSSourceFile externs.zip//fileapi.js> #<JSSourceFile externs.zip//flash.js> #<JSSourceFile externs.zip//gears_symbols.js> #<JSSourceFile externs.zip//gears_types.js> #<JSSourceFile externs.zip//gecko_xml.js> # |
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
| # from your project directory | |
| cljsc src {:optimizations :advanced} > hello.js | |
| open hello.html |
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
| # igrigorik { ~ } > rvm use jruby | |
| # Using /Users/igrigorik/.rvm/gems/jruby-1.6.2 | |
| # igrigorik { ~ } > gem install mvn:org.clojure:clojure | |
| # Successfully installed mvn:org.clojure:clojure-1.3.0.b.1-java | |
| # 1 gem installed | |
| require 'rubygems' | |
| require 'java' | |
| require 'maven/org.clojure/clojure' |
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 tiexample.core) | |
| (defn ^{:export dbg} dbg [s] | |
| (js* "Titanium.API.debug(~{s})")) | |
| ;;stolen from another gist I saw | |
| (defn make-js-map | |
| "makes a javascript map from a clojure one" | |
| [cljmap] | |
| (let [out (js-obj)] |
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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
| <title>Hello World</title> | |
| <script src="lib/touch/sencha-touch.js" type="text/javascript"></script> | |
| <script type="text/javascript" src="out/goog/base.js"></script> | |
| <script src="test.js" type="text/javascript"></script> | |
| <script>goog.require('test');</script> |
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
| (defpartial error-item [[first-error]] | |
| [:p.error first-error]) | |
| (defpartial user-fields [{:keys [firstname lastname]}] | |
| (vali/on-error :firstname error-item) | |
| (label "firstname" "First name: ") | |
| (text-field "firstname" firstname) | |
| (vali/on-error :lastname error-item) | |
| (label "lastname" "Last name: ") | |
| (text-field "lastname" lastname)) |