This file contains 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
;; vars since 1.4 in core | |
(for [[n v] (ns-publics 'clojure.core) :let [since (:added (meta v))] :when (= since "1.4")] n) |
This file contains 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
(.listFiles | |
(java.io.File. ".") | |
(reify | |
java.io.FileFilter | |
(accept [this f] | |
(.isDirectory f)))) |
This file contains 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=> (ancestors (class #{})) | |
#{clojure.lang.IFn java.lang.Runnable clojure.lang.AFn clojure.lang.Counted clojure.lang.IMeta clojure.lang.IHashEq clojure.lang.IObj clojure.lang.IEditableCollection java.util.Collection java.lang.Object clojure.lang.APersistentSet java.util.concurrent.Callable clojure.lang.IPersistentSet clojure.lang.IPersistentCollection clojure.lang.Seqable java.lang.Iterable java.io.Serializable java.util.Set} | |
user=> (ancestors (class "")) | |
#{java.lang.CharSequence java.lang.Comparable java.lang.Object java.io.Serializable} | |
user=> (doc ancestors) | |
------------------------- | |
clojure.core/ancestors | |
([tag] [h tag]) | |
Returns the immediate and indirect parents of tag, either via a Java type | |
inheritance relationship or a relationship established via derive. h |
This file contains 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
print 'hello python' |
This file contains 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
#!/bin/sh | |
export CLOJURE_EXT=$HOME/.clojure | |
export CLOJURE_OPTS="-Xmx1g -server" | |
LIBS=$(ls -1 $CLOJURE_EXT/* 2> /dev/null) | |
export CLASSPATH=.:$CLOJURE_EXT:$CLASSPATH:"$(echo "$LIBS" | tr \\n :)" | |
JAVA=${CLOJURE_JAVA:-java} | |
OPTS=${CLOJURE_OPTS:-} |
This file contains 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 '[clojure pprint repl]) | |
(use '[clojure.java shell browse javadoc jdbc]) | |
(load-file (str (System/getenv "HOME") "/.clojure.clj")) | |
(def completions (mapcat (comp keys ns-publics) (all-ns))) | |
(with-open [f (java.io.BufferedWriter. (java.io.FileWriter. (str (System/getenv "HOME") "/.clj_completions")))] | |
(.write f (apply str (interleave completions (repeat "\n"))))) |
This file contains 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.clone = function (o) { | |
var obj = Object.create(Object.getPrototypeOf(o)), | |
prop = Object.getOwnPropertyNames(o); | |
for (var i = prop.length, p; i--;) { | |
p = prop[i]; | |
Object.defineProperty(obj, p, Object.getOwnPropertyDescriptor(o, p)); | |
} | |
return obj; | |
}; |
This file contains 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
function toInt(number) { | |
return number && + number | 0 || 0; | |
} | |
console.log(toInt("1")); // 1 | |
console.log(toInt("1.2")); // 1 | |
console.log(toInt("-1.2")); // -1 | |
console.log(toInt(1.2)); // 1 | |
console.log(toInt(0)); // 0 | |
console.log(toInt("0")); // 0 |
This file contains 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
def get_Monday(d): | |
return d + datetime.timedelta(days=-d.weekday()) |
This file contains 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
;;; The following lines added by ql:add-to-init-file: | |
#-quicklisp | |
(let ((quicklisp-init (merge-pathnames "quicklisp/setup.lisp" | |
(user-homedir-pathname)))) | |
(when (probe-file quicklisp-init) | |
(load quicklisp-init))) | |
;;; Check for --no-linedit command-line option. | |
(if (member "--no-linedit" sb-ext:*posix-argv* :test 'equal) | |
(setf sb-ext:*posix-argv* |
OlderNewer