Skip to content

Instantly share code, notes, and snippets.

Fogus fogus

Block or report user

Report or block fogus

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View sea-grape.clj
(ns fogus.seance.advice
(:require [clojure.string :as string]
[robert.hooke :as hook]
fogus.seance.ext))
(defn- name-lexical
[n]
(symbol (string/upper-case (name n))))
(defn- name-delegate
View callcc.clj
(import 'clojure.lang.ExceptionInfo)
(defn call-cc [f]
(let [v (promise)
e (ex-info "cc" {:v v})]
(try (f #(do (deliver v %) (throw e)))
(catch ExceptionInfo ex
(if (identical? ex e)
@(:v (ex-data ex))
(throw ex))))))
View gist:9605639
;; Datomic example code
(use '[datomic.api :only (db q) :as d])
;; ?answer binds a scalar
(q '[:find ?answer :in ?answer]
42)
;; of course you can bind more than one of anything
(q '[:find ?last ?first :in ?last ?first]
"Doe" "John")
View gist:940739cb340f4d09bb91
fn(test
"A simple test function that takes two expressions and uses a function to test them"
[Expr1 Expr2 F Desc]
if(not(F(Expr1 Expr2))
out("Test of " Desc " failed!" crlf)
out(" " Expr1 " " F " " Expr2 crlf)
false
else
true))
View insurrection.md

Insurrection is a Chess variant where individual pieces can move up in rank and governments are toppled.

Setup

Insurrection is set up exactly like a regular game of Chess, shown below:

setup

Because of succession you might wish to have addional sets of pieces on hand.

View gist:6986facef31512cef4eb
Genetic Algorithms for the PAC-world
PAC-world is inhabited by several species of tiny creatures called PAC-mites, all of which are engaged in a constant struggle for survival with every other species. Each individual mite lives out its short lifetime by following a small set of deterministic rules and interacting only with its immediate surroundings. However, in large numbers, the PAC-mites of a species combine to form complex patterns of behavior which enable them to compete with PAC-mites of other species. Your goal is to design a species that will annihilate every other species in this world in a one-on-one duel.
The laws of PAC-world:
PAC-world consists of a grid of discrete cells measuring 21 cells horizontally by 11 cells vertically. The world is completely surrounded by insurmountable barriers that occupy the outermost cells. Therefore, the actual world measures 19 cells by 9 cells. (In the simulator the barriers are not displayed so only the 19x9 region is visible.)
Each cell may be occupied by ei
View schema->gen.clj
(ns schema->gen
"Functions for generating test data from schemas."
(:require [four.stateful :as four]
[re-rand :refer [re-rand]]
[schema.core :as sch]
[simple-check.generators :as gen]))
(defn ^:private re-randify-regex
"schema requires ^$ while re-rand forbids them"
[re]
@fogus
fogus / books2go.md
Last active Aug 29, 2015
I need to clear off some shelf space.
View books2go.md

I need to clear off some shelf space. I'd be willing to sell or trade the following:

  • Learn you some Erlang for Great Good
  • Learn you some Haskell for Great Good
  • Rails 3 in Action
  • Computer Lib / Dream Machines (Tempus printing)
  • The Haskell School of Expression
  • Natural Language Understanding (2nd ed)
  • The Art of UNIX programming
  • Speech and Language Processing
View tumblrsearch.cljs
(ns tumblrsearch.core
(:require-macros [cljs.core.async.macros :refer [go]])
(:require [clojure.browser.repl]
[cljs.core.async :as async :refer [put! chan <!]]
[om.core :as om :include-macros true]
[om.dom :as dom :include-macros true]
[figwheel.client :as fw :include-macros true]
)
(:import [goog.net Jsonp]
[goog Uri]
You can’t perform that action at this time.