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
(app/start callback-map {}) |
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
#import <Foundation/Foundation.h> | |
// ============================ | |
// MyClass | |
// ============================ | |
@class YourClass; | |
@interface MyClass : NSObject | |
{ |
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 littlesis.names | |
(:require [net.cgrand.enlive-html :as html])) | |
(def *base-url* "http://blog.littlesis.org/2010/02/18/sources-allege-goldman-sachs-and-john-paulson-are-partnering-in-speculative-attacks-o\ | |
n-greece/") | |
(defn fetch-url [url] | |
(html/html-resource (java.net.URL. url))) | |
(defn entry [node] |
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
(import [java.security MessageDigest]) | |
(def *sha1* "SHA-1") | |
(def *abc* (.getBytes "ABC")) | |
(def *abc-sha1* "3c1bdbb26f358bab27f267924aa2c9a3fcfdb8") | |
(defn start-message-digest [type] | |
(MessageDigest/getInstance type)) | |
(defn update-message-digest [#^MessageDigest md bytes] |
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
(def *section-sel* {[:h2] [:ul]}) | |
(defsnippet section-model "tutorial/template2.html" *section-sel* | |
[{:keys [title links]}] | |
[:h2] (content title) | |
[:ul] (content (map link-model links))) |
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
; Amaturish Clojure version of uniprot mapping function by @sjcockell | |
; Improved a bit by David Nolen | |
; http://blog.fuzzierlogic.com/archives/339 | |
; http://gist.github.com/329730 | |
(ns uniprot | |
(:use [clojure.contrib.duck-streams]) | |
(:require [clojure.contrib.str-utils2 :as s]) | |
(:import java.net.URLEncoder)) | |
(defn- url-encode [param] (URLEncoder/encode param)) |
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
(def m (ref {})) | |
(defn str-to-int [m s] | |
(or (@m s) | |
(dosync | |
(alter m assoc s (count @m)) | |
(@m s)))) |
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
;; this file is a walkthrough of Moustache features, a web framework for Clojure | |
;; http://github.com/cgrand/moustache/tree/master | |
;; Moustache allows to declare routes, apply middlewares and dispatch on http methods. | |
;; Moustache is compatible with all frameworks built on Ring, including Compojure | |
(ns demo | |
(:use net.cgrand.moustache) | |
(:use [ring.adapter.jetty :only [run-jetty]])) ;; hmmm Ring without servlets |
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
(def post-resource | |
(app ["view" slug] {:get get-post} | |
["new"] {:get new-post} | |
["new"] {:post save-post} | |
["edit" id] {:get edit-post})) |
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 test-code) | |
(defn foo [x y] | |
(+ x y)) | |
(foo z) ; line number | |
(foo 1 2 3) ; line number is 1 | |
(defn bar [x] | |
(foo x "bar")) |