(:identity req)is auth backend independent way to access user data- login and logout implementation depends on auth backend
:current-userdoesn't imply that authentication is required, route should also have:auth-rulesif authentication is required
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
| # 规则配置仅供参考,适用于 Surge iOS & Mac; | |
| # 包含 Proxy Group、URL Rewrite 特性; | |
| # 包含 Reject 规则,用于拦截广告、行为分析、数据统计; | |
| # 屏蔽 Hao123、百度联盟广告以及部分运营商网页漂浮广告; | |
| # Surge for Mac 简明指南 http://bit.ly/1TATRaG | |
| [General] | |
| # warning, notify, info, verbose | |
| loglevel = notify | |
| ipv6 = true |
For example, I have text files that ends with .scala extension and I want to associate an icon for that files through the whole system and for any newly created file of this extension.
Gisted from http://superuser.com/questions/178316/how-to-set-an-icon-for-a-file-type-on-mac
All credits go to the author of the accepted and top-voted answer by Daniel Beck
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
| <?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"> | |
| <!-- | |
| ABOUT: | |
| Clojure language module based on the newlisp package by | |
| Seth Dillingham <[email protected]> | |
| and Pete B. Anonymous. |
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 CHEATSHEET | |
| ;; | |
| ;; * :require makes functions available with a namespace prefix | |
| ;; and optionally can refer functions to the current ns. | |
| ;; | |
| ;; * :import refers Java classes to the current namespace. | |
| ;; | |
| ;; * :refer-clojure affects availability of built-in (clojure.core) | |
| ;; functions. |
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 ignore-trailing-slash | |
| "Modifies the request uri before calling the handler. | |
| Removes a single trailing slash from the end of the uri if present. | |
| Useful for handling optional trailing slashes until Compojure's route matching syntax supports regex. | |
| Adapted from http://stackoverflow.com/questions/8380468/compojure-regex-for-matching-a-trailing-slash" | |
| [handler] | |
| (fn [request] | |
| (let [uri (:uri request)] | |
| (handler (assoc request :uri (if (and (not (= "/" uri)) |
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
| 原帖地址: http://topic.csdn.net/u/20110113/19/b0d5d506-4307-428b-a61d-7974aa66a2da.html | |
| 首先要说明的是:这里介绍的方法都是大部分是本人“悟”出来的,所以网上难有流传! | |
| 好方法不能自己私藏,否则就白忙乎这几天了,分享给有需要的朋友们。如果有转载,敬请注明来自*CSDN老邓*作品。 | |
| 呵呵,给自己打广告,实在是无耻之极,权当无聊之时打字之用。 | |
| 欢迎流传,为最优秀的分布式版本管理系统Git做宣传!! | |
| 步骤: | |
| 1. 下载:http://loaden.googlecode.com/files/gitconfig.7z | |
| 2. 解压到:<MsysGit安装目录>/cmd/,例如:D:\Program Files\Git\cmd |
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
| ;;; Written when pondering | |
| ;;; http://stackoverflow.com/questions/9086926/create-a-proxy-for-an-specific-instance-of-an-object-in-clojure | |
| (defmacro delegating-proxy [o class-and-ifaces ctor-args & impls] | |
| (let [oname (gensym)] | |
| (letfn [(delegating-impls [^java.lang.reflect.Method ms] | |
| (let [mname (symbol (.getName ^java.lang.reflect.Method (first ms))) | |
| arity-groups (partition-by #(count (.getParameterTypes ^java.lang.reflect.Method %)) ms) | |
| max-arity (max-key #(count (.getParameterTypes ^java.lang.reflect.Method %)) ms)] | |
| `(~mname |
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 callback-based API | |
| (defn call-service [arg1 arg2 callback-fn] | |
| ; ...perform service call, eventually invoking callback-fn with results... | |
| (future (callback-fn (+ arg1 arg2) (- arg1 arg2)))) | |
| (defn sync-fn [async-fn] | |
| (fn [& args] | |
| (let [result (promise)] | |
| (apply async-fn (conj (vec args) #(deliver result %&))) | |
| @result))) |
