Load fix
parent
5ecf3f7225
commit
78abc143d6
|
@ -25,14 +25,10 @@ $nl
|
||||||
ABOUT: "number-strings"
|
ABOUT: "number-strings"
|
||||||
|
|
||||||
HELP: digits>integer
|
HELP: digits>integer
|
||||||
{ $values { "radix" "an integer between 2 and 36" } { "seq" "a sequence of integers" } { "n" integer } }
|
{ $values { "seq" "a sequence of integers" } { "radix" "an integer between 2 and 36" } { "n" integer } }
|
||||||
{ $description "Converts a sequence of digits (with most significant digit first) into an integer." }
|
{ $description "Converts a sequence of digits (with most significant digit first) into an integer." }
|
||||||
{ $notes "This is one of the factors of " { $link string>number } "." } ;
|
{ $notes "This is one of the factors of " { $link string>number } "." } ;
|
||||||
|
|
||||||
HELP: valid-digits?
|
|
||||||
{ $values { "radix" "an integer between 2 and 36" } { "seq" "a sequence of integers" } { "?" "a boolean" } }
|
|
||||||
{ $description "Tests if this sequence of integers represents a valid integer in the given radix." } ;
|
|
||||||
|
|
||||||
HELP: >digit
|
HELP: >digit
|
||||||
{ $values { "n" "an integer between 0 and 35" } { "ch" "a character" } }
|
{ $values { "n" "an integer between 0 and 35" } { "ch" "a character" } }
|
||||||
{ $description "Outputs a character representation of a digit." }
|
{ $description "Outputs a character representation of a digit." }
|
||||||
|
@ -43,11 +39,6 @@ HELP: digit>
|
||||||
{ $description "Converts a character representation of a digit to an integer." }
|
{ $description "Converts a character representation of a digit to an integer." }
|
||||||
{ $notes "This is one of the factors of " { $link string>number } "." } ;
|
{ $notes "This is one of the factors of " { $link string>number } "." } ;
|
||||||
|
|
||||||
HELP: string>integer
|
|
||||||
{ $values { "str" string } { "radix" "an integer between 2 and 36" } { "n/f" "an integer or " { $link f } } }
|
|
||||||
{ $description "Creates an integer from a string representation." }
|
|
||||||
{ $notes "The " { $link base> } " word is more general." } ;
|
|
||||||
|
|
||||||
HELP: base>
|
HELP: base>
|
||||||
{ $values { "str" string } { "radix" "an integer between 2 and 36" } { "n/f" "a real number or " { $link f } } }
|
{ $values { "str" string } { "radix" "an integer between 2 and 36" } { "n/f" "a real number or " { $link f } } }
|
||||||
{ $description "Creates a real number from a string representation with the given radix. The radix is ignored for floating point literals; they are always taken to be in base 10."
|
{ $description "Creates a real number from a string representation with the given radix. The radix is ignored for floating point literals; they are always taken to be in base 10."
|
||||||
|
|
|
@ -1,28 +0,0 @@
|
||||||
<% USING: namespaces math io ; %>
|
|
||||||
|
|
||||||
<h1>Annotate</h1>
|
|
||||||
|
|
||||||
<form method="POST" action="/responder/pastebin/annotate-paste">
|
|
||||||
|
|
||||||
<table>
|
|
||||||
|
|
||||||
<input type="hidden" name="n" value="<% "n" get number>string write %>" />
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<th>Summary:</th>
|
|
||||||
<td><input type="TEXT" name="summary" value="" /></td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<th>Your name:</th>
|
|
||||||
<td><input type="TEXT" name="author" value="" /></td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<th valign="top">Contents:</th>
|
|
||||||
<td><textarea rows="24" cols="60" name="contents"></textarea></td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<input type="SUBMIT" value="Annotate" />
|
|
||||||
</form>
|
|
|
@ -1,11 +0,0 @@
|
||||||
<% USING: namespaces io ; %>
|
|
||||||
|
|
||||||
<h2>Annotation: <% "summary" get write %></h2>
|
|
||||||
|
|
||||||
<table>
|
|
||||||
<tr><th>Annotation by:</th><td><% "author" get write %></td></tr>
|
|
||||||
<tr><th>Channel:</th><td><% "channel" get write %></td></tr>
|
|
||||||
<tr><th>Created:</th><td><% "date" get write %></td></tr>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<pre><% "contents" get write %></pre>
|
|
|
@ -1,4 +0,0 @@
|
||||||
REQUIRES: libs/concurrency libs/furnace libs/irc libs/store ;
|
|
||||||
|
|
||||||
PROVIDE: apps/furnace-pastebin
|
|
||||||
{ +files+ { "pastebin.factor" } } ;
|
|
|
@ -1,27 +0,0 @@
|
||||||
<form method="POST" action="/responder/pastebin/submit-paste">
|
|
||||||
|
|
||||||
<table>
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<th>Summary:</th>
|
|
||||||
<td><input type="TEXT" name="summary" value="" /></td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<th>Your name:</th>
|
|
||||||
<td><input type="TEXT" name="author" value="" /></td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<th>Channel:</th>
|
|
||||||
<td><input type="TEXT" name="channel" value="" /></td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<th valign="top">Contents:</th>
|
|
||||||
<td><textarea rows="24" cols="60" name="contents"></textarea></td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<input type="SUBMIT" value="Submit paste" />
|
|
||||||
</form>
|
|
|
@ -1,7 +0,0 @@
|
||||||
<% USING: namespaces furnace sequences ; %>
|
|
||||||
|
|
||||||
<table width="100%">
|
|
||||||
<% "new-paste-quot" get "New paste" render-link %>
|
|
||||||
<tr align="left"><th> </th><th>Summary:</th><th>Paste by:</th><th>Link</th><th>Date</th></tr>
|
|
||||||
<% "pastes" get <reversed> [ "paste-summary" render-template ] each %></table>
|
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
<% USING: namespaces io kernel math furnace ; %>
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<td><% "n" get number>string write %></td>
|
|
||||||
<td><% "summary" get write %></td>
|
|
||||||
<td><% "author" get write %></td>
|
|
||||||
<td><% "n" get number>string "show-paste-quot" get curry "Show" render-link %></td>
|
|
||||||
<td><% "date" get print %></td>
|
|
||||||
</tr>
|
|
|
@ -1,110 +0,0 @@
|
||||||
IN: furnace:pastebin
|
|
||||||
USING: calendar concurrency irc kernel namespaces sequences
|
|
||||||
furnace hashtables math store ;
|
|
||||||
|
|
||||||
TUPLE: paste n summary author channel contents date annotations ;
|
|
||||||
|
|
||||||
TUPLE: annotation summary author contents ;
|
|
||||||
|
|
||||||
C: paste ( summary author channel contents -- paste )
|
|
||||||
V{ } clone over set-paste-annotations
|
|
||||||
[ set-paste-contents ] keep
|
|
||||||
[ set-paste-channel ] keep
|
|
||||||
[ set-paste-author ] keep
|
|
||||||
[ set-paste-summary ] keep ;
|
|
||||||
|
|
||||||
TUPLE: pastebin pastes ;
|
|
||||||
|
|
||||||
C: pastebin ( -- pastebin )
|
|
||||||
V{ } clone over set-pastebin-pastes ;
|
|
||||||
|
|
||||||
SYMBOL: store
|
|
||||||
"pastebin.store" load-store store set-global
|
|
||||||
<pastebin> pastebin store get store-variable
|
|
||||||
|
|
||||||
: add-paste ( paste pastebin -- )
|
|
||||||
now timestamp>http-string pick set-paste-date
|
|
||||||
dup pastebin-pastes length pick set-paste-n
|
|
||||||
pastebin-pastes push ;
|
|
||||||
|
|
||||||
: get-paste ( n -- paste )
|
|
||||||
pastebin get pastebin-pastes nth ;
|
|
||||||
|
|
||||||
: show-paste ( n -- )
|
|
||||||
get-paste "show-paste" "Paste" render-page ;
|
|
||||||
|
|
||||||
\ show-paste { { "n" v-number } } define-action
|
|
||||||
|
|
||||||
: new-paste ( -- )
|
|
||||||
f "new-paste" "New paste" render-page ;
|
|
||||||
|
|
||||||
\ new-paste { } define-action
|
|
||||||
|
|
||||||
: make-remote-process
|
|
||||||
"trifocus.net" 4030 <node> "public-irc" <remote-process> ;
|
|
||||||
|
|
||||||
: alert-new-paste ( paste -- )
|
|
||||||
>r make-remote-process r>
|
|
||||||
f over paste-channel rot [
|
|
||||||
dup paste-author %
|
|
||||||
" pasted " %
|
|
||||||
CHAR: " ,
|
|
||||||
dup paste-summary %
|
|
||||||
CHAR: " ,
|
|
||||||
" at " %
|
|
||||||
"http://wee-url.com/responder/pastebin/show-paste?n=" %
|
|
||||||
paste-n #
|
|
||||||
] "" make <chat-command> swap send ;
|
|
||||||
|
|
||||||
: alert-annotation ( annotation paste -- )
|
|
||||||
make-remote-process -rot
|
|
||||||
f over paste-channel 2swap [
|
|
||||||
over annotation-author %
|
|
||||||
" annotated paste " %
|
|
||||||
" with \"" %
|
|
||||||
over annotation-summary %
|
|
||||||
"\" at " %
|
|
||||||
"http://wee-url.com/responder/pastebin/show-paste?n=" %
|
|
||||||
dup paste-n #
|
|
||||||
2drop
|
|
||||||
] "" make <chat-command> swap send ;
|
|
||||||
|
|
||||||
|
|
||||||
: submit-paste ( summary author channel contents -- )
|
|
||||||
<paste> dup pastebin get-global add-paste
|
|
||||||
alert-new-paste store get save-store ;
|
|
||||||
|
|
||||||
\ submit-paste {
|
|
||||||
{ "summary" v-required }
|
|
||||||
{ "author" v-required }
|
|
||||||
{ "channel" "#concatenative" v-default }
|
|
||||||
{ "contents" v-required }
|
|
||||||
} define-action
|
|
||||||
|
|
||||||
: paste-list ( -- )
|
|
||||||
[
|
|
||||||
[ show-paste ] "show-paste-quot" set
|
|
||||||
[ new-paste ] "new-paste-quot" set
|
|
||||||
|
|
||||||
pastebin get "paste-list" "Pastebin" render-page
|
|
||||||
] with-scope ;
|
|
||||||
|
|
||||||
\ paste-list { } define-action
|
|
||||||
|
|
||||||
\ submit-paste [ paste-list ] define-redirect
|
|
||||||
|
|
||||||
: annotate-paste ( paste# summary author contents -- )
|
|
||||||
<annotation> swap get-paste
|
|
||||||
[ paste-annotations push ] 2keep
|
|
||||||
alert-annotation store get save-store ;
|
|
||||||
|
|
||||||
\ annotate-paste {
|
|
||||||
{ "n" v-required v-number }
|
|
||||||
{ "summary" v-required }
|
|
||||||
{ "author" v-required }
|
|
||||||
{ "contents" v-required }
|
|
||||||
} define-action
|
|
||||||
|
|
||||||
\ annotate-paste [ "n" show-paste ] define-redirect
|
|
||||||
|
|
||||||
"pastebin" "paste-list" "apps/furnace-pastebin" web-app
|
|
|
@ -1,15 +0,0 @@
|
||||||
<% USING: namespaces io furnace sequences ; %>
|
|
||||||
|
|
||||||
<h1>Paste: <% "summary" get write %></h1>
|
|
||||||
|
|
||||||
<table>
|
|
||||||
<tr><th>Paste by:</th><td><% "author" get write %></td></tr>
|
|
||||||
<tr><th>Channel:</th><td><% "channel" get write %></td></tr>
|
|
||||||
<tr><th>Created:</th><td><% "date" get write %></td></tr>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<pre><% "contents" get write %></pre>
|
|
||||||
|
|
||||||
<% "annotations" get [ "annotation" render-template ] each %>
|
|
||||||
|
|
||||||
<% model get "annotate-paste" render-template %>
|
|
Loading…
Reference in New Issue