View clj_ns_buffer_names.el
;; Rename clj/cljs/cljc buffers to their namespace name, so you see
;; `foo.bar.core' in the modeline, rather than `core.clj'
(advice-add 'rename-buffer :around #'plexus/clj-ns--rename-buffer-advice)
(defun plexus/clj-ns--rename-buffer-advice (rb-fun newname &optional unique &rest args)
(let ((filename (buffer-file-name (current-buffer)))
(buf-start (buffer-substring-no-properties (point-min) (point-min))))
(if (and (string-match "\\.clj[cxs]?$" filename)
(string-match "(ns \\([^\n )]+\\)" buf-start))
(match-string-no-properties 1 buf-start)
View .emacs
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; (package-initialize)
(setq chemacs-profiles-path "~/.emacs-profiles.el")
(when (not (file-exists-p chemacs-profiles-path))
(with-temp-file chemacs-profiles-path
(insert "((\"default\" . ((user-emacs-directory . \"~/.emacs.d\"))))")))
View generate_docs
#!/bin/bash
# Keep a separate branch of generated API docs.
#
# This script generates API documentation, commits it to a separate branch, and
# pushes it upstream. It does this without actually checking out the branch,
# using a separate working tree directory, so without any disruption to your
# current working tree. You can have local file modifications, but the git index
# (staging area) must be clean.
View async.clj
(ns slacker.async)
(defmacro promise
"Creates a promise. Takes a binding form which binds the [resolve reject]
callbacks.
(promise [res rej]
(res 42))"
{:style/indent 1}
[bindings & body]
View async.clj
(ns slacker.async)
(defmacro promise
"Creates a promise. Takes a binding form which binds the [resolve reject]
callbacks.
(promise [res rej]
(res 42))"
{:style/indent 1}
[bindings & body]
View Code.gs
if(typeof Math.imul == "undefined" || (Math.imul(0xffffffff,5) == 0)) {
Math.imul = function (a, b) {
var ah = (a >>> 16) & 0xffff;
var al = a & 0xffff;
var bh = (b >>> 16) & 0xffff;
var bl = b & 0xffff;
// the shift by 0 fixes the sign on the high part
// the final |0 converts the unsigned value into a signed value
return ((al * bl) + (((ah * bl + al * bh) << 16) >>> 0)|0);
}
View webstack.clj
(ns lambdaisland.components.webstack
(:require [com.stuartsierra.component :as component]))
(defn stack-tier-handler
"Create the ring handler for a single stack tier"
[component {:keys [make-handler middleware using]}]
(reduce (fn [h mw]
(if (vector? mw)
(apply (first mw) h (rest mw))
(mw h)))
View ring_proxy.clj
(ns stuck.ring-proxy
(:import
[java.net URI] )
(:require
[clj-http.client :refer [request]]
[ring.middleware.cookies :refer [wrap-cookies]]
[clojure.string :refer [join split]]))
(defn prepare-cookies
"Removes the :domain and :secure keys and converts the :expires key (a Date)
View emacs-unrepl.el
(defvar-local unrepl-repl-input-start-mark nil)
(defvar-local unrepl-hello-payload nil)
(edn-add-reader :unrepl/param (lambda (x) `(:unrepl/param . ,x)))
(edn-add-reader :unrepl/ns (lambda (x) `(:unrepl/ns . ,x)))
(edn-add-reader :unrepl/ratio (lambda (x) `(:unrepl/ratio . ,x)))
(edn-add-reader :unrepl/meta (lambda (x) `(:unrepl/meta . ,x)))
(edn-add-reader :unrepl/pattern (lambda (x) `(:unrepl/pattern . ,x)))
(edn-add-reader :unrepl/object (lambda (x) `(:unrepl/object . ,x)))
(edn-add-reader :unrepl.java/class (lambda (x) `(:unrepl.java/class . ,x)))
View models.clj
(ns lambdaisland.models
(:require [honeysql.format :as hformat]
[toucan.models :as models :refer [invoke-model-or-instance]]))
(defn fully-qualified-symbol [s]
(let [{:keys [ns name]} (meta (resolve s))]
(symbol (str ns "/" name))))
(defn extend-syntax->map [forms]
(second