Skip to content

Instantly share code, notes, and snippets.

View gist:69c50ace9a5d888c9a48
[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 Aug 29, 2015
A few words on fold for a friend who had just read http://www.cs.nott.ac.uk/~gmh/fold.pdf
View fold-and-spindle.clj
;; 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
View tree.go
package main
import (
"fmt"
"io"
"os"
)
type Tree struct {
Children []*Tree
@jordanorelli
jordanorelli / templates.go
Created Aug 9, 2012
primitive template cache in Go with os.Stat
View templates.go
package core
import (
"bytes"
"fmt"
"html/template"
"io/ioutil"
"net/http"
"os"
"path/filepath"
View gist:4262177
#lang r5rs
(define-syntax var
(syntax-rules ()
((_ x) (vector x))))
(define-syntax var?
(syntax-rules ()
((_ x) (vector? x))))
View btsync+backupsy.md

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

View radical.cljs
(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"
View client.cljs
(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 Jan 21, 2014
View ux.cljs
;;; 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!]]
)
View core.cljs
(ns react-cljs.core
(:require React))
(declare render)
(defn handle-change [e]
(render {:text (.. e -target -value)}))
(defn render [{:keys [text]}]
(React/renderComponent