Skip to content

Instantly share code, notes, and snippets.

[info] Starting scala interpreter...
[info]
Welcome to Scala version 2.10.4 (OpenJDK 64-Bit Server VM, Java 1.6.0_32).
Type in expressions to have them evaluated.
Type :help for more information.
scala> def f = 1
def f = 1
f: Int
@jackrusher
jackrusher / fold-and-spindle.clj
Last active August 29, 2015 14:06
A few words on fold for a friend who had just read http://www.cs.nott.ac.uk/~gmh/fold.pdf
;; simplest fold definition
(defn fold [f init l]
(if (empty? l) init (fold f (f init (first l)) (rest l))))
;; by this time you are almost certainly comfortable with signatures like:
;; Int -> Int
(fold + 0 [1 2 3 4 5])
;; => 15
@jordanorelli
jordanorelli / tree.go
Created June 5, 2012 21:18
a tree, in go
package main
import (
"fmt"
"io"
"os"
)
type Tree struct {
Children []*Tree
#lang r5rs
(define-syntax var
(syntax-rules ()
((_ x) (vector x))))
(define-syntax var?
(syntax-rules ()
((_ x) (vector? x))))

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}})
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!]]
)
(ns react-cljs.core
(:require React))
(declare render)
(defn handle-change [e]
(render {:text (.. e -target -value)}))
(defn render [{:keys [text]}]
(React/renderComponent
@loganlinn
loganlinn / history.cljs
Last active November 19, 2017 20:13
history.cljs
(ns history
"Light wrappers and utils for js/history")
(defn back! [] (.back js/history))
(defn forward! [] (.forward js/history))
(defn go! [idx] (.go js/history idx))
(defn replace-state!