Skip to content

Instantly share code, notes, and snippets.

Anthony Grimes Raynes

Block or report user

Report or block Raynes

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View when-let-lol.clj
(defroutes chapter-routes
;; Example story-slug: 42-my-first-story
;; Example chapter-slug: 99-introduction
;; (util/parse-uid "42-my-first-story") -> 42
;; (util/parse-uid "99-introduction") -> 99
(GET "/chapters/:chapter-slug" [story-slug chapter-slug]
(when-let [story-uid (util/parse-uid story-slug)]
(when-let [chapter-uid (util/parse-uid chapter-slug)]
(when-let [story (db/find-story-by-uid story-uid)]
(when-let [chapter (db/find-chapter-by-uid chapter-uid)]
View gist:6643618
(defn ?assoc-transform
"(?assoc-transform {:a 1} :a 2 sequential? vector) => {:a [1 2]}"
[m k v test transform]
(let [val (m k)]
(assoc m k
(if-let [okay (test val)]
v
(transform val v)))))
View gist:5527809
<html>
<head>
</head>
<body>
</body>
</html>
View main.cpp
#include <iostream>
using namespace std;
char x[27];
char c = 'a';
int main()
{
for (int i = 0; i < 26; i++) {
x[i] = c;
View gist:4188351
(defproject noir-example "0.1.0"
:description "An example of a noir project"
:dependencies [[org.clojure/clojure "1.4.0"]
[noir "1.3.0"]]
:plugins [[lein-ring "0.7.5"]]
:ring {:handler noir-example.server/handler}
:main noir-example.server)
View gist:3907782
Making install in src
/bin/sh ../libtool --tag=CC --mode=compile cc -DHAVE_CONFIG_H -I. -I.. -Wall -c -o icns_debug.lo icns_debug.c
/bin/sh ../libtool --tag=CC --mode=compile cc -DHAVE_CONFIG_H -I. -I.. -Wall -c -o icns_element.lo icns_element.c
/bin/sh ../libtool --tag=CC --mode=compile cc -DHAVE_CONFIG_H -I. -I.. -Wall -c -o icns_family.lo icns_family.c
/bin/sh ../libtool --tag=CC --mode=compile cc -DHAVE_CONFIG_H -I. -I.. -Wall -c -o icns_image.lo icns_image.c
libtool: compile: cc -DHAVE_CONFIG_H -I. -I.. -Wall -c icns_image.c -fno-common -DPIC -o .libs/icns_image.o
libtool: compile: cc -DHAVE_CONFIG_H -I. -I.. -Wall -c icns_family.c -fno-common -DPIC -o .libs/icns_family.o
libtool: compile: cc -DHAVE_CONFIG_H -I. -I.. -Wall -c icns_element.c -fno-common -DPIC -o .libs/icns_element.o
libtool: compile: cc -DHAVE_CONFIG_H -I. -I.. -Wall -c icns_debug.c -fno-common -DPIC -o .libs/icns_debug.o
brew: superenv removed: -Wall
View refheap.js
$(document).ready(function(){
$("#signin").click(function(event) {
alert("SIGN THE FUCK IN.")
})
});
View core.clj
(defn ^{:skip-wiki true} route->name
"Parses a set of route args into the keyword name for the route"
[route]
(cond
(keyword? route) route
(fn? route) (keyword (:name (meta route)))
:else (let [res (first (parse-route [{} [route]] 'compojure.core/GET))]
(keyword (:fn-name res)))))
View *slime-repl nil*
user> (pygmentize "clojure" "(+ 3 3)")
"<div class=\"highlight\"><pre><span class=\"p\">(</span><span class=\"nb\">+ </span><span class=\"mi\">3</span> <span class=\"mi\">3</span><span class=\"p\">)</span>\n</pre></div>\n"
View *slime-repl nil*
refheap.models.paste> (binding [session/*noir-session* (atom {})] (paste {:description "A paste." :language "Haskell" :contents "main = putStrLn \"Hello, World!\""}))
{:paste-id 6, :user "anonymous", :description "A paste.", :language "Haskell", :contents "<div class=\"highlight\"><pre><span class=\"nf\">main</span> <span class=\"ow\">=</span> <span class=\"n\">putStrLn</span> <span class=\"s\">&quot;Hello, World!&quot;</span>\n</pre></div>\n", :_id #<ObjectId 4ef6675cd6c4de4c8a84efed>}
You can’t perform that action at this time.