Skip to content

Instantly share code, notes, and snippets.

View vito's full-sized avatar

Alex Suraci vito

View GitHub Profile
@vito
vito / 0-from
Created December 12, 2010 18:02
-- | Foo
{ bar :: Baz
-- | Blah
, fizz :: Buzz
-- | Fizzbuzz
, blah :: Etc
}
@vito
vito / derive.lisp
Created December 11, 2010 19:25
deriving in common lisp
(ql:quickload "fare-matcher")
(defpackage :derive
(:use :common-lisp
:fare-matcher))
(in-package :derive)
(defvar *variable*)
Object -- Unary 1; the root trait, very first one created; 1 is its "tag"
Foo = Object clone -- Union (Unary 2) (Unary 1) (@clone might become @derive or something)
Bar = Foo clone -- Union (Unary 3) (Union (Unary 2) (Unary 1))
Fizz = Foo clone -- Union (Unary 4) (Union (Unary 2) (Unary 1))
-- defines on trait:
-- Intersection (Unary 2) (Unary 3)
-- note that the unions are gone; it only intersects on the "heads"
(f: Foo) x: (b: Bar) := 1
@vito
vito / gist:728358
Created December 4, 2010 17:59
basic atomo blog
website: Blog: {
"/" -> page: {
Post all (sort-by: { a b | a created-at < b created-at })
each: { p | join: p pretty }
}
"/post" -> page: {
(Post get: (parameter: "id")) match: {
@(ok: p) -> super join: p pretty
@none -> not-found
@vito
vito / gist:728346
Created December 4, 2010 17:38
session garbage collector
Timer do: {
Session all each: { s |
when: (Timer now - s created-at > 1 month) do: {
"Cleaning up expired session " (.. s id) print
s delete!
}
}
} every: 1 day
@vito
vito / gist:727844
Created December 4, 2010 02:24
atomo web fun: logging in
"/login" ->
{ h1: "hi!"
{ prompt: { url |
form: {
input: "password"
submit: "log in"
} action: url method: "post"
}
} until: { parameter: "password" == "secret" }
@vito
vito / derive.atomo
Created December 1, 2010 04:41
derivatives in atomo
define: *variable* as: @no-variable
(b: Block) derive :=
with: *variable* as: b arguments head name do: {
Block: b contents (map: @derive) arguments: b arguments
}
`(~x ^ ~y) derive :=
condition: {
-- constant exponent
@vito
vito / gist:717381
Created November 27, 2010 00:08
arc challenge on mongrel2 + atomo
use: "web"
Site = Website new: [
"/" ->
{ form: {
input: "foo"
submit
} action: {
foo = parameter: "foo"
link: "click here" to: {
[ui]
username = Alex Suraci <[email protected]>
[extensions]
bookmarks =
color =
convert =
crecord = ~/.hgext/crecord
eol =
extdiff =
[0]> for-macro 1 print
1
@ok
[0]> { for-macro 1 print }
1
1
{ for-macro 1 print }
[0]> { { for-macro 1 print } }
1
1