Skip to content

Instantly share code, notes, and snippets.

View Tree.java
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;
View gist:78a87a523731d84d0f9430ad267d421f
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) => {
View app.cljs
(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"))
@konrad-garus
konrad-garus / gist:4733108
Last active Dec 12, 2015
Compilation of KO sample from David Nolen
View gist:4733108
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) {
@konrad-garus
konrad-garus / gist:876978
Created Mar 18, 2011
Rewrite of "Processing in Clojure"
View gist:876978
(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
View compojure-encoding-issue.clj
; 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")
View gist:588677
(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]