Skip to content

Instantly share code, notes, and snippets.

@KSCGroup
KSCGroup / cljs-repl-session.txt
Created September 29, 2012 04:03
Testing the doc, apropos, ns-reolve, ns-map/refer/aliases equivalent functions for clojurescript... getting there...
user=> (run-repl-listen 9000 ".lein-cljsbuild-repl")
"Type: " :cljs/quit " to quit"
ClojureScript:cljs.user> (cljs-doc cljs-doc)
----------------------------------------------------------------------
cljs-doc - Special Form
([n])
Prints documentation for a var, namespace, or special form.
Name n is string, symbol, or quoted symbol.
@KSCGroup
KSCGroup / clojure.plist
Created May 16, 2012 16:58
smultron/fraise (poor-man's) syntax definition for clojure
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>beginCommand</key>
<string>(</string>
<key>endCommand</key>
<string> </string>
<key>beginInstruction</key>
<string></string>
@KSCGroup
KSCGroup / trace-predicates.clj
Created April 23, 2012 16:54
Two convenience function for clojure.tools.trace
;; Two convenience function for clojure.tools.trace
(defn var-traceable?
"Predicate that returns whether a var is traceable or not."
[v]
(and (var? v) (ifn? @v) (-> v meta :macro not)))
(defn var-traced?
"Predicate that returns whether a var is currently being traced."
@KSCGroup
KSCGroup / lein-plugin-upgrade.log
Created March 5, 2012 05:10
Log of a terminal session that shows how the lein-repls plugin can be up/down-graded
~>cljsh -u
Determine if the lein-repls plugin is installed...
Determine what lein-repls version is installed (need to start server if needed)...
Current lein-repls version is: "1.9.5".
Downloading lein-repls info from clojars...
Available versions on clojars:
[lein-repls "1.0.0-SNAPSHOT"]
[lein-repls "1.1.0-SNAPSHOT"]
[lein-repls "1.2.0-SNAPSHOT"]
[lein-repls "1.3.0-SNAPSHOT"]
@KSCGroup
KSCGroup / keyword_patch.clj
Created March 2, 2012 06:28
patch to clojure.core/keyword to allow different types for [ns name] interface, on par with [name]
(in-ns 'clojure.core)
(defn keyword-fs
"Returns a Keyword with the given namespace and name. Do not use :
in the keyword strings, it will be added automatically."
{:tag clojure.lang.Keyword
:added "1.0"
:static true}
([name] (cond (keyword? name) name
(symbol? name) (clojure.lang.Keyword/intern ^clojure.lang.Symbol name)
Last login: Wed Feb 22 13:10:26 on ttys009
~>cd '/Users/franks/Development/Clojure/httprof'
~/Development/Clojure/httprof>ls
README.md project.clj src test
~/Development/Clojure/httprof>lein repls
Downloading: clj-http/clj-http/0.2.7/clj-http-0.2.7.pom from repository central at http://repo1.maven.org/maven2
Unable to locate resource in repository
[INFO] Unable to find resource 'clj-http:clj-http:pom:0.2.7' in repository central (http://repo1.maven.org/maven2)
Downloading: clj-http/clj-http/0.2.7/clj-http-0.2.7.pom from repository clojars at http://clojars.org/repo/
Transferring 3K from clojars
@KSCGroup
KSCGroup / doc.clj
Created February 20, 2012 22:39
reversed sequence of "(cond...(resolve...(find-ns..." to "(cond...(find-ns...(resolve..." to make doc work with ns, like (doc clojure.core)
(in-ns 'clojure.repl)
(defmacro doc
"Prints documentation for a var or special form given its name"
{:added "1.0"}
[name]
(if-let [special-name ('{& fn catch try finally try} name)]
(#'print-doc (#'special-doc special-name))
(cond
(special-doc-map name) `(#'print-doc (#'special-doc '~name))
(find-ns name) `(#'print-doc (#'namespace-doc (find-ns '~name)))
@KSCGroup
KSCGroup / cljsh-macosx-install.log
Created February 17, 2012 17:57
Log of all the installation steps for cljsh, lein and lein repls on MacOSX 10.7.3 from scratch (no lein, no cljsh...)
Last login: Fri Feb 17 09:36:04 on ttys007
~>sudo rm -rf ~/.m2/ .lein/ ~/opt/bin/cljsh ~/opt/bin/lein /usr/bin/cljsh /usr/bin/lein
Password:
~>curl https://raw.github.com/technomancy/leiningen/stable/bin/lein > ~/opt/bin/lein
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 9824 100 9824 0 0 10808 0 --:--:-- --:--:-- --:--:-- 20552
~>chmod +x ~/opt/bin/lein
~>sudo ln -s /Users/franks/opt/bin/lein /usr/bin/lein
~>curl https://raw.github.com/franks42/lein-repls/stable/bin/cljsh > ~/opt/bin/cljsh
@KSCGroup
KSCGroup / cljsh-lubuntu-install.log
Created February 16, 2012 06:22
Log of all the installation steps for cljsh, lein and lein repls on lubuntu 11.10 from scratch (no lein, no cljsh...)
admin@lubuntu:~$ mkdir Development bin
admin@lubuntu:~$ curl https://raw.github.com/technomancy/leiningen/stable/bin/lein > bin/lein
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 9824 100 9824 0 0 12419 0 --:--:-- --:--:-- --:--:-- 18397
admin@lubuntu:~$ chmod +x bin/lein
admin@lubuntu:~$ sudo ln -s /home/admin/bin/lein /usr/local/bin/lein
admin@lubuntu:~$ curl https://raw.github.com/franks42/lein-repls/stable/bin/cljsh > bin/cljsh
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
@KSCGroup
KSCGroup / cljsh-test.log
Created February 16, 2012 05:19
Logfile from running cljsh-test.sh with cljsh 1.9.4, lein-repls-1.9.4-SNAPSHOT on LUBUNTU 11.10
# cljsh-test.sh is a bash shell script that tests most non-interactive use cases for cljsh.
# Use the following command to capture the annotated output of this script in a log-file
# ./cljsh-test.sh > cljsh-test.log 2>&1
# all clojure scripts are passed to the "lein repl" server over the network/loopback
# for eval, and the output is brought back to stdout.
# cljsh -h will give help info and does some basic diagnostics