]> gitweb.factorcode.org Git - factor.git/commitdiff
robohash: adding a robot-based hashing tool.
authorJohn Benediktsson <mrjbq7@gmail.com>
Wed, 1 Apr 2015 21:56:23 +0000 (14:56 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Wed, 1 Apr 2015 21:56:23 +0000 (14:56 -0700)
extra/robohash/authors.txt [new file with mode: 0644]
extra/robohash/robohash.factor [new file with mode: 0644]
extra/robohash/summary.txt [new file with mode: 0644]

diff --git a/extra/robohash/authors.txt b/extra/robohash/authors.txt
new file mode 100644 (file)
index 0000000..e091bb8
--- /dev/null
@@ -0,0 +1 @@
+John Benediktsson
diff --git a/extra/robohash/robohash.factor b/extra/robohash/robohash.factor
new file mode 100644 (file)
index 0000000..11e4361
--- /dev/null
@@ -0,0 +1,23 @@
+! Copyright (C) 2011 John Benediktsson.
+! See http://factorcode.org/license.txt for BSD license.
+
+USING: images.http kernel sequences urls urls.encoding ;
+
+IN: robohash
+
+<PRIVATE
+
+: robohash-url ( str -- url )
+    url-encode "http://robohash.org/" prepend >url ;
+
+: (robohash) ( str type -- image )
+    [ robohash-url ] [ "set" set-query-param ] bi*
+    load-http-image ;
+
+PRIVATE>
+
+: robohash1 ( str -- image ) "set1" (robohash) ;
+
+: robohash2 ( str -- image ) "set2" (robohash) ;
+
+: robohash3 ( str -- image ) "set3" (robohash) ;
diff --git a/extra/robohash/summary.txt b/extra/robohash/summary.txt
new file mode 100644 (file)
index 0000000..195de23
--- /dev/null
@@ -0,0 +1 @@
+Robohash!