Skip to content

Instantly share code, notes, and snippets.

(defn- xhtml-template [head title body]
{:status 200
:headers {"Content-Type" "text/html; charset=utf-8"}
:body
(html
(doctype :xhtml-strict)
(xhtml-tag "en"
[:head
[:meta {:http-equiv "Content-Type" :content "text/html; charset=utf-8"}]
[:title title]
; project.clj
(defproject enc-test "1.0.0-SNAPSHOT"
:description "FIXME: write"
:dependencies [[org.clojure/clojure "1.2.0"]
[org.clojure/clojure-contrib "1.2.0"]
[ring/ring-jetty-adapter "0.3.0"]
[compojure "0.4.1"]]
:repl-init-script "src/encoding_issue/repl.clj")
@konrad-garus
konrad-garus / gist:876978
Created March 18, 2011 22:36
Rewrite of "Processing in Clojure"
(import [processing.core PApplet])
(def angle-seq (iterate #(+ (Math/toRadians 10) %) 0))
(defn calculate-scale [angle] (* (Math/cos angle) 6))
(def scale-seq (atom (map calculate-scale angle-seq)))
(defn generate-scale []
(do
@konrad-garus
konrad-garus / gist:4733108
Last active December 12, 2015 06:58
Compilation of KO sample from David Nolen
var hello_clojurescript = {AppViewModel:function(a, b, c) {
this.firstName = a;
this.lastName = b;
this.fullName = c
}};
hello_clojurescript.AppViewModel.cljs$lang$type = !0;
hello_clojurescript.AppViewModel.cljs$lang$ctorPrSeq = function() {
return cljs.core.list.call(null, "hello-clojurescript/AppViewModel")
};
hello_clojurescript.AppViewModel.cljs$lang$ctorPrWriter = function(a, b) {
(ns tutorial.app
(:require [tutorial.controllers :as ctrl]))
(defn ng-route [provider path route-spec]
(.when provider path (clj->js route-spec)))
(defn ng-route-otherwise [provider route-spec]
(.otherwise provider (clj->js route-spec)))
(doto (angular/module "phonecat" (array "phonecatFilters" "phonecatServices"))
function createDir(name, parent) {
return new Promise((res, rej) => {
console.log(`Creating ${name} with parent ${parent}`);
res(name);
});
}
const dirsToCreate = ['foo', 'bar', 'baz', 'boo'];
dirsToCreate.reduce(async (parentPromise, dir) => {
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.stream.Stream;
import static java.util.Arrays.asList;
import static java.util.stream.Collectors.toList;
public class Tree {
private int value;