Skip to content

Commit

Permalink
Basically stable.
Browse files Browse the repository at this point in the history
  • Loading branch information
samth committed Oct 19, 2012
1 parent 2ff278c commit 2eff619
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 315 deletions.
Binary file removed assets/fonts/segoeui-webfont.eot
Binary file not shown.
257 changes: 0 additions & 257 deletions assets/fonts/segoeui-webfont.svg

This file was deleted.

Binary file removed assets/fonts/segoeui-webfont.ttf
Binary file not shown.
Binary file removed assets/fonts/segoeui-webfont.woff
Binary file not shown.
49 changes: 23 additions & 26 deletions assets/style.css
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
@font-face {
font-family: 'SegoeUINormal';
src: url('/assets/fonts/segoeui-webfont.eot');
src: url('/assets/fonts/segoeui-webfont.eot?#iefix') format('embedded-opentype'),
url('/assets/fonts/segoeui-webfont.woff') format('woff'),
url('/assets/fonts/segoeui-webfont.ttf') format('truetype'),
url('/assets/fonts/segoeui-webfont.svg#SegoeUINormal') format('svg');
font-weight: normal;
font-style: normal;
}

html {

}
Expand All @@ -17,7 +6,7 @@ body {
padding: 0;
height: 100%;
color: hsl(80.0,2%,34%);
font-family: 'SegoeUINormal', sans-serif;
font-family: 'PT Sans', sans-serif;
font-style: normal;
font-weight: normal;
font-size: 14px;
Expand All @@ -26,12 +15,9 @@ body {
}
html, body {
background-color: #E8E8E8;
background-image: -moz-linear-gradient(left top, #8494ad, #d69baf);
background-image: -ms-linear-gradient(left top, #8494ad, #d69baf);
background-image: -o-linear-gradient(left top, #8494ad, #d69baf);
background-image: -webkit-linear-gradient(left top, #8494ad, #d69baf);
background-image: linear-gradient(left top, #8494ad, #d69baf);
background-image: url("/assets/plt-back.1024x768.png");
background-attachment: fixed;
background-size: cover;
}
p, ul, ol, dl, pre {
margin-top: 18.2px;
Expand Down Expand Up @@ -69,17 +55,18 @@ a {
text-decoration: none;
}
h1, h2, h3, h4, h5, h6 {
font-family: 'SegoeUINormal', sans-serif;
font-family: 'PT Sans', sans-serif;
font-style: normal;
font-weight: normal;
font-weight: normal;
}
h1 {
display: inline-block;
margin: 0;
color: #FBFBFB;
color: black;
font-size: 33.6px;
}

h2 {

}
Expand Down Expand Up @@ -156,6 +143,15 @@ div.code {
div.code .syntaxhighlighter table .line {
padding: 0 18.2px;
}

pre.pline {
margin-top: 0pt;
margin-bottom: 0pt;
margin-left: 0pt;
padding: 0pt;
font-size: 14px;
}

ul.output {
margin: 0;
padding: 18.2px;
Expand Down Expand Up @@ -192,7 +188,7 @@ ul.actions {
border: 0;
background-color: transparent;
color: #585856;
font-family: 'SegoeUINormal', sans-serif;
font-family: 'PT Sans', sans-serif;
font-style: normal;
font-weight: normal;
-moz-transition: all 0.2s ease-out;
Expand Down Expand Up @@ -225,14 +221,15 @@ p.meta {
padding: 18.2px;
border-top: 1px solid #E9E9E9;
}
#fork-of p {
#fork-of p {
margin: 0;
}
}
footer {
margin-top: 50px;
margin-bottom: 50px;
color: hsla(0.0,0%,0%,0.25098039215686274);
font-size: 18.2px;
text-align: right;
margin-top: 50px;
margin-bottom: 50px;
color: hsla(0.0,0%,0%,0.25098039215686274);
font-size: 10pt;
}
.muted {
color: #E8E8E8;
Expand Down
60 changes: 28 additions & 32 deletions main.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -18,32 +18,32 @@

(define-runtime-path static "./")

(define styles
`(
(link ((type "text/css")
(rel "stylesheet")
(href "/assets/style.css")))
(link ((type "text/css")
(rel "stylesheet")
(href "/assets/media_queries.css")))
(link ((type "text/css")
(rel "stylesheet")
(href "/assets/normalize.css")))
(link ((type "text/css")
(rel "stylesheet")
(href "/assets/font-awesome.css")))
(link ((type "text/css")
(rel "stylesheet")
(href "http://fonts.googleapis.com/css?family=Droid+Sans+Mono")))))
(define (CSS u)
`(link ([type "text/css"]
(rel "stylesheet")
(href ,u))))

(define styles
(map CSS '("/assets/normalize.css"
"/assets/media_queries.css"
"/assets/style.css"
"/assets/font-awesome.css"
"http://fonts.googleapis.com/css?family=PT+Sans"
"http://fonts.googleapis.com/css?family=Droid+Sans+Mono")))

(define hdr
`(header ((role "banner"))
(a ((href "/"))
(h1 "paste.rkt"))))
(a ((href "/")) (h1 "paste.rkt"))))

(define footer
`(footer (p "Made by Sam Tobin-Hochstadt, styling stolen from cljbin")))
`(footer (p "Made with " (a ([href "http://racket-lang.org"]) "Racket") " by "
(a ([href "http://www.ccs.neu.edu/home/samth"]) "Sam Tobin-Hochstadt")
". Styling stolen from "
(a ([href "https://github.com/gf3/CLJBIN"]) "cljbin")
". Source at "
(a ([href "https://github.com/samth/rktbin"]) "GitHub")
". Fonts from " (a ([href "http://fortawesome.github.com/Font-Awesome"]) "FontAwesome")
".")))

(define default-placeholder "Racket code here")

Expand Down Expand Up @@ -100,22 +100,18 @@
(define (show-paste req id)
(define q (sequence->list (mongo-dict-query "pastes" (hash 'hash id))))
(response/xexpr
(cond [(null? q)
`(html (head (title "paste.rkt") ,@styles)
,hdr ,footer)]
(cond [(null? q) fail-page]
[else (define p (car q))
(define parent (paste-parent p))
(define result (paste-result p))
(define content (paste-content p))
(define when (paste-date p))
`(html (head (title "paste.rkt")
,@styles)
`(html (head (title "paste.rkt") ,@styles)
(body
,hdr
(section ([id "paste"])
(form ((action ,(string-append "/fork/" id)) (method "get"))
(div ([class "code"]) ,(format-code content))

(ul ([class "output"])
,@(format-result result))
,(if parent
Expand All @@ -136,7 +132,7 @@
(define (format-code c)
(define lines
(for/list ([l (regexp-split "\n" c)])
`(div ([class "line"]) (code ,l))))
`(div ([class "line"]) (pre ([class "pline"]) ,l))))
`(div
([class "syntaxhighlighter"])
(table
Expand Down Expand Up @@ -185,15 +181,16 @@
;; redirect to the permanent page
(define new-url (->url show-paste hash))
(redirect-to new-url)]
[else (response/xexpr
'(html (head (title "Failed") ,@styles)
(body (h1 "Failed"))))]))
[else (response/xexpr fail-page)]))

(define fail-page
'(html (head (title "paste.rkt") ,@styles)
(body (h1 "Not Found"))))

(define-values (dispatch ->url)
(dispatch-rules
[("") #:method "get" main-page]
[("new") #:method "post" new-paste]
[() #:method "post" new-paste]
[("paste" (string-arg)) show-paste]
[("fork" (string-arg)) main-page]))

Expand All @@ -202,4 +199,3 @@
#:extra-files-paths (list static)
#:servlet-regexp #rx""
#:servlet-path "")

0 comments on commit 2eff619

Please sign in to comment.