Skip to content

Instantly share code, notes, and snippets.

View outworlder's full-sized avatar

Stephen Pedrosa Eilert outworlder

  • San Francisco Bay Area
View GitHub Profile
(use iup)
(define btn-ok
(button title: "OK"))
(define btn-activate
(button title: "Activate"))
(define btn-exit
package main
import "fmt"
import "rpc/jsonrpc"
import "net"
import "time"
type Message struct {
message string
(defmacro maybe-require (package &rest body)
"Tries to load the specified package. If it succeeds, then body is executed (if provided)."
(if body
`(progn
(if (require ,package nil t)
(progn
,@body)))
`(require ,package nil t)))
(use tcp)
(use srfi-18)
;; (repl-prompt "[iPhone] #; ")
(define (my-repl)
(display "[iPhone] #; ")
(let ([result (eval (read))])
(print result)))
@outworlder
outworlder / lpthw-advice-from-an-old-programmer.markdown
Created November 30, 2010 19:10
Final Chapter in Learn Python the Hard Way

Advice From An Old Programmer

You have finished this book and have decided to continue with programming. Maybe it will be a career for you, or maybe it will be a hobby. You will need some advice to make sure you continue on the right path, and get the most enjoyment out of your newly chosen hobby.

I have been programming for a very long time. So long that it is incredibly boring to me. At the time that I wrote this book I knew about 20 programming languages and could learn new ones in about a day to a week depending on how weird they were. Eventually though this just became boring and couldn’t hold my interest.

#;2> ,p (get-production-prices "Wetware Mainframe")
Executing: SELECT typeID,groupID,typeName,description,iconID,radius,mass,volume,capacity,portionSize,raceID,basePrice,published,marketGroupID,chanceOfDuplicating FROM invtypes WHERE typeName like "%Wetware Mainframe%"
Executing: SELECT schematicID,typeID,quantity,isInput FROM planetschematicstypemap WHERE typeID = 2377
Executing: SELECT schematicID,typeID,quantity,isInput FROM planetschematicstypemap WHERE typeID = 2876
Executing: SELECT schematicID,schematicName,cycleTime FROM planetSchematics WHERE schematicID = 119
Executing: SELECT schematicID,typeID,quantity,isInput FROM planetschematicstypemap WHERE schematicID = 119
Executing: SELECT typeID,groupID,typeName,description,iconID,radius,mass,volume,capacity,portionSize,raceID,basePrice,published,marketGroupID,chanceOfDuplicating FROM invtypes WHERE typeID = 2349
Executing: SELECT schematicID,typeID,quantity,isInput FROM planetschematicstypemap WHERE typeID = 2349
Executing: SELECT schematicID,schematicNam
#;10> ,p (make-production-tree (get-item (find-by-id <planet-schematics> 65)))
Executing: SELECT schematicID,schematicName,cycleTime FROM planetSchematics WHERE schematicID = 65
Executing: SELECT schematicID,typeID,quantity,isInput FROM planetschematicstypemap WHERE schematicID = 65
Executing: SELECT typeID,groupID,typeName,description,iconID,radius,mass,volume,capacity,portionSize,raceID,basePrice,published,marketGroupID,chanceOfDuplicating FROM invtypes WHERE typeID = 9838
Executing: SELECT schematicID,typeID,quantity,isInput FROM planetschematicstypemap WHERE typeID = 9838
Executing: SELECT schematicID,schematicName,cycleTime FROM planetSchematics WHERE schematicID = 65
Executing: SELECT schematicID,typeID,quantity,isInput FROM planetschematicstypemap WHERE schematicID = 65
Executing: SELECT typeID,groupID,typeName,description,iconID,radius,mass,volume,capacity,portionSize,raceID,basePrice,published,marketGroupID,chanceOfDuplicating FROM invtypes WHERE typeID = 2389
Executing: SELECT schematicID,typeID,qua
(define *database-url*
(make-parameter "tyr104-sqlite3-v1.db"))
(define-class <table> ()
(name columns (relationships initform: '())))
(define-class <model> ()
(table))
(define-syntax with-model
(include "orly")
(define-model <inventory-categories> "invcategories"
(categoryID categoryName description iconID published))
(has-many <inventory-categories> <inventory-groups> groups foreign-key: categoryID)
(define-model <inventory-type-reactions> "invtypereactions"
(reactionTypeID input typeID quantity))
(define-syntax has-many
(syntax-rules (foreign-key:)
([_ parent child method-name foreign-key: column-name]
(define-method (method-name (model parent))
(find-all-by-id child (slot-value model (quote column-name)))))))
(has-many <planet-schematics> <planet-schematics-typemap> typemaps foreign-key: schematicID)