Skip to content

Instantly share code, notes, and snippets.

View sl4m's full-sized avatar
😎
😎

skim sl4m

😎
😎
View GitHub Profile
@slagyr
slagyr / gist:950574
Created May 1, 2011 15:22
Game of Life in 8 lines of Clojure
(defn neighbors-of [cell]
(set (for [dx [-1 0 1] dy [-1 0 1] :when (not (= [dx dy] [0 0]))]
[(+ dx (first cell)) (+ dy (second cell))])))
(defn alive? [[cell freqs] world]
(or (and (= 2 freqs) (contains? world cell)) (= 3 freqs)))
(defn tick [world]
(let [frequencies (frequencies (reduce #(concat %1 (neighbors-of %2)) [] world))]
(set (keys (filter #(alive? % world) frequencies)))))
MySQL commands (from http://www.pantz.org/software/mysql/mysqlcommands.html)
Create a database on the sql server.
mysql> create database [databasename];
List all databases on the sql server.
mysql> show databases;
Switch to a database.
mysql> use [db name];
@sl4m
sl4m / gist:712272
Created November 23, 2010 18:45
smalltalk_reference.st
"Chris Rathman / [email protected]
************************************************************************
* Allowable characters: *
* - a-z *
* - A-Z *
* - 0-9 *
* - .+/\*~<>@%|&? *
* - blank, tab, cr, ff, lf *
* *
* Variables: *