Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

#lang r5rs
(define-syntax var
(syntax-rules ()
((_ x) (vector x))))
(define-syntax var?
(syntax-rules ()
((_ x) (vector? x))))
@ptaoussanis
ptaoussanis / free-port.clj
Created December 14, 2012 06:28
A little utility to allow simple redeployment of Clojure web servers with zero downtime, and without the need for a proxy or load balancer. Just wrap any port-binding calls, and the utility will auto kill pre-existing servers as necessary. *nix only. Based on the blog post by Feng Shen, http://shenfeng.me/fast-restart-clojure-webapp.html
;; (require '[clojure.string :as str] '[clojure.java.shell :as shell] '[taoensso.timbre :as timbre])
(defn with-free-port!
"Attempts to kill any current port-binding process, then repeatedly executes
nullary `bind-port!-fn` (which must return logical true on successful
binding). Returns the function's result when successful, else throws an
exception. *nix only.
This idea courtesy of Feng Shen, Ref. http://goo.gl/kEolu."
[port bind-port!-fn & {:keys [max-attempts sleep-ms]
@stuarthalloway
stuarthalloway / gist:5199642
Created March 19, 2013 20:11
Draw a pedestal dataflow with dorothy + Graphviz
;; from leiningen, use [dorothy/dorothy "0.0.3"]
(require '[dorothy.core :as dot])
;; dataflow copied from chat
;; https://github.com/pedestal/samples/blob/master/chat/chat-client/app/src/chat_client/behavior.clj
(def dataflow '{:transform
{:outbound {:init {} :fn outbound-transform}
:inbound {:init {} :fn inbound-transform}
:nickname {:init nil :fn nickname-transform}}
:effect {:outbound send-message-to-server}
@a2ndrade
a2ndrade / gist:5234370
Last active March 15, 2019 22:21
Datomic Pro Setup: MySQL
# download
wget http://downloads.datomic.com/0.8.3848/datomic-pro-0.8.3848.zip
unzip datomic-pro-X.X.zip & cd datomic-pro-X.X
# install as a maven artifact
./bin/maven-install
# configure transactor.properties
cp config/samples/sql-transactor-template.properties transactor.properties
# protocol=sql

Auto Synchronized Backups with Bittorrent sync & a vps

1. Cloud syncing on the cheap

Two awsome things were released yesterday :

Compare this to the pricing of : dropbox pro

(ns async-test.core
(:require [cljs.core.async :refer [chan]]
[clojure.string :as string])
(:require-macros
[cljs.core.async.macros :as m :refer [go alt! alts!]]))
(def c (chan))
(def loc-div (.getElementById js/document "location"))
(.addEventListener js/window "mousemove"
(def cds (collection))
;; interact with database
(go
(>! (:in cds)
{:op :create
:val {:title "Soft Machine Vol. 1"
:artist "Soft Machine"
:year 1969}})
@bradmontgomery
bradmontgomery / install-comodo-ssl-cert-for-nginx.rst
Last active April 1, 2024 11:21
Steps to install a Comodo PositiveSSL certificate with Nginx.

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

(ns react-cljs.core
(:require React))
(declare render)
(defn handle-change [e]
(render {:text (.. e -target -value)}))
(defn render [{:keys [text]}]
(React/renderComponent
anonymous
anonymous / ux.cljs
Created January 21, 2014 19:06
;;; TODO - drag-enter and -exit events : Right now, a component doesn't receive events for other components
;;; If a component responds to drag-over, it won't "revert" state until the drag ends.
;; NOTE - compiles with om 0.1.7. Needs updating to 0.2+
(ns omdnd.ux
(:require-macros
[cljs.core.async.macros :refer [go alt!]]
)