Skip to content

Instantly share code, notes, and snippets.

@brandonbloom
brandonbloom / gist:6f18edfd40cfdf008f81
Last active August 29, 2015 14:19
dynamic styles
Follow up to https://twitter.com/BrandonBloom/status/591772674193403905
No idea if this will even work, much less perform well. This is just an idea.
Let's say you've got this file:
var color = 'red';
// ...
#lang typed/racket/no-check
;;; Types
(define-type Expr (U Symbol Term))
(define-type Term (Pairof Symbol (Listof Expr)))
(define-type Strategy (-> Expr (Option Expr)))
@juliangamble
juliangamble / gist:7e9692a2840227c950a8
Created September 28, 2014 04:28
References from Nada Amin's StrangeLoop Talk 'Programming Should Eat Itself'
Here is a reference to the part of the video where the slides are listed:
https://www.youtube.com/watch?v=SrKj4hYic5A&feature=youtu.be&t=28m
Here are the references:
SMITH - Reflection and Semantics in Lisp - 1983
http://www-public.it-sudparis.eu/~gibson/Teaching/CSC7322/ReadingMaterial/Smith84.pdf
WAND & FRIEDMAN - The Mystery of the Tower in Lisp - 1986
http://www.cs.indiana.edu/pub/techreports/TR196.pdf
@Chouser
Chouser / externs_for_cljs.clj
Created June 17, 2013 13:44
Generate an externs.js file for arbitrary JS libraries for use in advanced Google Closure compilation, based on the ClojureScript code that uses the libraries.
(ns n01se.externs-for-cljs
(:require [clojure.java.io :as io]
[cljs.compiler :as comp]
[cljs.analyzer :as ana]))
(defn read-file [file]
(let [eof (Object.)]
(with-open [stream (clojure.lang.LineNumberingPushbackReader. (io/reader file))]
(vec (take-while #(not= % eof)
(repeatedly #(read stream false eof)))))))
@semperos
semperos / clojure-deftype-scaffolding.clj
Created October 4, 2012 18:16
Clojure Scaffolding for deftype (Christophe Grand) - Show which methods a class implements and for which interfaces
;; Big thanks to Christophe Grand - https://groups.google.com/d/msg/clojure/L1GiqSyQVVg/m-WJogaqU8sJ
(defn scaffold [iface]
(doseq [[iface methods] (->> iface .getMethods
(map #(vector (.getName (.getDeclaringClass %))
(symbol (.getName %))
(count (.getParameterTypes %))))
(group-by first))]
(println (str " " iface))
(doseq [[_ name argcount] methods]
(println
@swannodette
swannodette / gist:3217582
Created July 31, 2012 14:52
sudoku_compact.clj
;; based on core.logic 0.8-alpha2 or core.logic master branch
(ns sudoku
(:refer-clojure :exclude [==])
(:use clojure.core.logic))
(defn get-square [rows x y]
(for [x (range x (+ x 3))
y (range y (+ y 3))]
(get-in rows [x y])))