Skip to content

Instantly share code, notes, and snippets.

View jessealama's full-sized avatar

Jesse Alama jessealama

View GitHub Profile
#lang racket/base
(require racket/list
web-server/http
web-server/servlet-env
web-server/dispatch
json)
#|
Our database will be an (eq) hash table whose keys are symbols.
#lang racket
(require http) ;; not installed by default
;; do raco pkg install http
(define (http-request uri
#:redirects [redirects 10]
#:http-version [http-version "1.1"]
#:method [method "GET"]
#:data [data #""]
#lang racket
(require web-server/servlet
web-server/servlet-env
web-server/templates)
(define html-utf-8-mime-type
"text-html; charset=utf-8")
(define html-utf-8-mime-type/bytes
#lang racket
(define (env)
;; Association list of the current environvment variables and their values.
;;
;; NB: Both the car and the cdr of the returned cons cells are byte strings,
;; not simply strings. If you're looking for strings, you'll need to do
;; a bit of work.
(define (names env)
(environment-variables-names env))
<reddit-user-info status="public" date="YYYY-MM-DD" timezone="UTC" username="USERNAME">
<karma posts="postkarma" comments="commentkarma" total="totalkarma"/>
<subreddit-catalog>
<subreddit name="name" status="status" link="https://www.reddit.com/r/Example/">
<modstatus permissions="none"/>
</subreddit>
</subreddit-catalog>
</reddit-user-info>