This file contains 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
#lang racket | |
(require web-server/http | |
web-server/managers/none | |
web-server/servlet | |
web-server/servlet-env) | |
(provide interface-version manager star-polling-app) | |
(define interface-version 'v2) |
This file contains 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
(defmacro def-curry-fn [name args & body] | |
{:pre [(not-any? #{'&} args)]} | |
(if (empty? args) | |
`(defn ~name ~args ~@body) | |
(let [rec-funcs (reduce (fn [l v] | |
`(letfn [(helper# | |
([] helper#) | |
([x#] (let [~v x#] ~l)) | |
([x# & rest#] (let [~v x#] | |
(apply (helper# x#) rest#))))] |
This file contains 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
#!/bin/sh -x | |
cd /tmp | |
if [ ! -d "geocouch" ]; then | |
git clone https://github.com/couchbase/geocouch.git | |
fi | |
cd geocouch | |
git checkout couchdb1.2.x |
This file contains 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 algos.dijkstra | |
(use '[clojure.contrib.incubator]) | |
) | |
(declare dijkstra build-path add-rdist update-rdists take-minnode) | |
(defn shortest-path | |
([net root nodedst children distance] |
This file contains 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
/* | |
* Dependencies: Apache POI Library from http://poi.apache.org/ | |
*/ | |
package poi_excels; | |
import java.io.FileInputStream; | |
import java.io.FileNotFoundException; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.util.logging.Level; |
This file contains 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
;; by John Lawrence Aspden - http://www.learningclojure.com/2013/04/destructuring.html | |
;; Destructuring | |
;; One of Clojure's great strengths is the ability to create maps ad-hoc and to deal with them easily. | |
;; You can create an ad-hoc structure with named fields: | |
{:a 3 :b 1} | |
;; And unpack it, providing defaults for its values if they are not present, as easily as: |
This file contains 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 tokenring.core | |
(:require [lamina.core :as lamina]) | |
(:require [aleph.tcp :as aleph]) | |
(:require [gloss.core :as gloss])) | |
(defn connect-and-send [message] | |
(println (str "connecting and sending: " message)) | |
(let [ch (lamina/wait-for-result | |
(aleph/tcp-client {:host "192.168.48.35" | |
;;:host "localhost" |
This file contains 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-core-typed.core | |
(:import (clojure.lang Symbol)) | |
(:require [clojure.core.typed :refer [ann]])) | |
(ann foo-bar [Symbol -> Number]) | |
(defn foo-bar [a] | |
(+ a 1)) | |
(ann barbar [Number -> Boolean]) | |
(defn barbar [a] |
This file contains 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
1) make sure you actually HAVE postgres AND postgis AND plsql! | |
2) enable postgis extension (may be in a different path or already coming from your distribution) | |
psql -U YOURUSER -d YOURDB -f /usr/share/postgresql/contrib/postgis-2.0/postgis.sql | |
or, on psql shell: | |
CREATE extension postgis; |
This file contains 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
checkbox :: Bool -> IO (Elem, Signal Bool) | |
checkbox checked = do | |
c <- newElem "input" | |
(p,s) <- emptyPipe | |
setProp c "type" "checkbox" | |
sink (\isChecked -> do | |
setProp c "checked" $ if isChecked then "true" else "" | |
) s | |
setCallback c OnChange (do | |
checked <- getProp c "checked" |
OlderNewer