Skip to content

Instantly share code, notes, and snippets.

(ns prov.core
(:require [pallet.core]
[pallet.utils :as utils]
[pallet.phase :as phase]
[pallet.action.package :as package]
[pallet.compute :as compute]
[pallet.crate.ssh :as ssh]
[pallet.crate.automated-admin-user :as automated-admin-user]))
(def service
@Gozala
Gozala / example.js
Created January 29, 2012 03:46
Workaround for lack of "tail call optimization" in JS
// Lack of tail call optimization in JS
var sum = function(x, y) {
return y > 0 ? sum(x + 1, y - 1) :
y < 0 ? sum(x - 1, y + 1) :
x
}
sum(20, 100000) // => RangeError: Maximum call stack size exceeded
// Using workaround
(ns monad-explore.core
(:use clojure.algo.monads))
(defmacro let?
"Almost the same as let. If you add the :ensure keyword paired with
some predicate as a var in the let form, let? will not continue
unless the predicate evaluates to true. (The predicate will have
access to all bindings above.)"
[bindings & body]
(let [[bind [kwd pred & more]] (split-with (complement #{:ensure}) bindings)]
@mmcgrana
mmcgrana / server.clj
Created January 8, 2012 22:12 — forked from anonymous/server.clj
http.server example
(ns http.server
(:require [vertx.http :as http]))
(def server (http/server))
(defn vertx-start
[]
(-> server
(http/on-request
(fn [req resp]
@lynaghk
lynaghk / main.clj
Created January 6, 2012 15:26
Cassowary constraint solver in ClojureScript
;;Using the Cassowary constraint solver from ClojureScript
;;This demo shows using multimethods for readable constraint syntax using +, -, and =.
;;Output is a row of circles with random radii spaced so that the space between their boundaries is uniform.
(ns c2.main
;;refer-clojure :exclude is currently broken in ClojureScript master
;;Ticket open: http://dev.clojure.org/jira/browse/CLJS-114
;;Fix applied here: https://github.com/lynaghk/clojurescript/tree/114-refer-clojure-exclude
(:refer-clojure :exclude [+ - =])
@tbatchelli
tbatchelli / logback.xml
Created December 22, 2011 23:46
logback config for pallet
<configuration scan="true" scanPeriod="1 seconds" debug="true">
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<ImmediateFlush>true</ImmediateFlush>
<!-- deny all events with a level below INFO, that is TRACE and DEBUG -->
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>ERROR</level>
</filter>
<encoder>
<pattern>%d{HH:mm:ss.SSS} %-5level - %msg%n</pattern>
</encoder>
@hugoduncan
hugoduncan / gist:1503375
Created December 20, 2011 21:31
crontab crate with monads
(ns pallet.crate.crontab
"crontab management"
(:refer-clojure :exclude [alias])
(:require
[clojure.tools.logging :as logging]
[pallet.action.exec-script :as exec-script]
[pallet.action.file :as file]
[pallet.action.remote-file :as remote-file]
[pallet.action.user :as user]
[pallet.script.lib :as lib]
@tsabat
tsabat / zsh.md
Last active April 21, 2025 07:22
Getting oh-my-zsh to work in Ubuntu
anonymous
anonymous / core.cljs
Created December 16, 2011 18:00
clojuresrcipt question
(ns simplebutton.core
(:require [goog.dom :as dom]))
;; -------------------------= Debug =-----------------------
(defn debug
"Output goes to your web browser's console"
[msg]
(js/console.log msg))
;(defn debug [_]) ;; switch to this debug to turn off output
(defpallet
:services
{:virtualbox {:provider "virtualbox"
:model-path "/Users/sritchie/.vmfest/models"
:node-path "/Users/sritchie/.vmfest/nodes"
:default-local-interface "vboxnet0"
:default-bridged-interface "en1: AirPort"
:default-network-type :local
:url "http://localhost:18083"
:identity ""