Permalink
Browse files

Use aif macro from planet, thus removing utils.rkt.

  • Loading branch information...
dchest committed Nov 23, 2010
1 parent 24bf9c2 commit a227c8282d4b892dfc08e3c61c01582afb26bc36
Showing with 13 additions and 21 deletions.
  1. +3 −3 LICENSE
  2. +10 −9 app.rkt
  3. +0 −9 utils.rkt
View
@@ -2,7 +2,7 @@ License for "I Write Like" source code and data
===============================================
1. Source code (*.rkt, *.html, *.css)
--------------------------------------------------------------------------------
-------------------------------------------------------------------------------
Copyright (c) 2010, Dmitry Chestnykh. All rights reserved.
@@ -31,13 +31,13 @@ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------------
-------------------------------------------------------------------------------
2. All images (located in /static/ directory) are in public domain.
3. Data corpus (located in /data/ directory) is in public domain.
--------------------------------------------------------------------------------
-------------------------------------------------------------------------------
4. Not a license, but a trademark notice: you cannot call your own publicly
running version of the program (modified or not) "I Write Like" without my
View
19 app.rkt
@@ -8,9 +8,10 @@
racket/runtime-path
mzlib/defmacro)
(require (planet schematics/macro/aif))
(require "bayes.rkt"
"crc32.rkt"
"utils.rkt")
"crc32.rkt")
(define *app-version* 8)
(define *app-date* "November 2010")
@@ -49,9 +50,9 @@
(string-append "/b/" (string->crc32/hex author)))
(define (show-index req)
(aif (dict-ref (request-bindings req) 'text #f)
(aif (get-author it)
(redirect-to (badge-url it))
(aif text (dict-ref (request-bindings req) 'text #f)
(aif url (get-author text)
(redirect-to (badge-url url))
(index-template #t))
(index-template #f)))
@@ -77,8 +78,8 @@
[client-id (dict-ref bindings 'client_id #f)] ; unused, but required
[permalink (dict-ref bindings 'permalink #f)]) ; -"-
(if (and text client-id permalink)
(aif (get-author text)
(json-result wrapper it)
(aif writer (get-author text)
(json-result wrapper writer)
(json-error "text is too short or doesn't have words"))
(json-error "not enough arguments"))))
@@ -103,12 +104,12 @@
(badge-template req crc "templates/show-shared.html"))
(define (show-writer req crc)
(aif (crc->author crc)
(aif writer (crc->author crc)
(redirect-to
(format (string-append
"http://www.amazon.com/gp/search?ie=UTF8&keywords=~a"
"&tag=blogjetblog-20&index=books&linkCode=ur2"
"&camp=1789&creative=9325") it))
"&camp=1789&creative=9325") writer))
(not-found req)))
(define (show-newsletter req)
View

This file was deleted.

Oops, something went wrong.

0 comments on commit a227c82

Please sign in to comment.