]> gitweb.factorcode.org Git - factor.git/blob - extra/robohash/robohash.factor
webapps.wiki: simplify and fix table layouts
[factor.git] / extra / robohash / robohash.factor
1 ! Copyright (C) 2011 John Benediktsson.
2 ! See http://factorcode.org/license.txt for BSD license.
3
4 USING: images.http kernel sequences urls urls.encoding ;
5
6 IN: robohash
7
8 <PRIVATE
9
10 : robohash-url ( str -- url )
11     url-encode "http://robohash.org/" prepend >url ;
12
13 : (robohash) ( str type -- image )
14     [ robohash-url ] [ "set" set-query-param ] bi*
15     load-http-image ;
16
17 PRIVATE>
18
19 : robohash1 ( str -- image ) "set1" (robohash) ;
20
21 : robohash2 ( str -- image ) "set2" (robohash) ;
22
23 : robohash3 ( str -- image ) "set3" (robohash) ;