cleaning main/app

This commit is contained in:
johncburnham 2014-08-05 14:02:17 -07:00
parent 764e7d4a98
commit 88d8346ec3
7 changed files with 0 additions and 469 deletions

View File

@ -1,103 +0,0 @@
!:
=> |%
++ axle
$% [%0 p=@ud]
==
++ gult
$% [%json p=json]
:: [%hymn p=manx]
==
++ gilt
$% :: [%json p=json]
[%hymn p=manx]
==
++ gift
$% [%rust gilt]
[%nice gult]
==
++ move ,[p=bone q=[%give p=gift]]
--
|_ [hid=hide vat=axle]
++ page
^- manx
;html
;head
;title: Foobug!
==
;body
;p: Word: {<p.vat>}.
;button(onclick "goof()"): Goof!
;script:'''
var c = 0;
var d = 1;
var x = 0;
function pickup() {
xhr = new XMLHttpRequest();
console.log("WTF???");
xhr.open("GET", "/zod/goe/foobug/"+port+"/frog/"+d);
xhr.onload = function() {
console.log("pickup");
console.log(this)
change(JSON.parse(this.responseText))
update();
d++;
pickup();
}
xhr.send();
}
function dude() {
xhr = new XMLHttpRequest();
xhr.open("POST", "/zod/pos/foobug/"+port+"/frog/goof");
xhr.setRequestHeader("content-type", "text/json")
xhr.onload = function() {
console.log("dude");
console.log(this)
change(JSON.parse(this.responseText))
update();
pickup();
}
xhr.send("{\"a\":1}")
}
dude();
function change(jon) {
x = jon.x;
}
function update() {
document.getElementsByTagName("p")[0].innerHTML = "WORD: " + x;
}
function goof() {
xhr = new XMLHttpRequest();
xhr.onload = function() {
console.log("hi");
console.log(arguments)
c++
}
xhr.open("POST",
"/zod/pom/foobug/"+port+"/"+c)
xhr.setRequestHeader("content-type", "text/json")
xhr.send("{\"a\":1}")
}
'''
==
==
::
++ peer
|= [ost=bone you=ship pax=path]
^- [(list move) _+>]
[[ost %give %rust %hymn page]~ +>]
::
++ poke-json
|= [ost=bone you=ship jon=json]
^- [(list move) _+>]
~& [%poke [%state p.vat] ost you jon]
:_ +>(p.vat +(p.vat))
:~ [ost %give %nice %json jon]
==
--

View File

@ -1,45 +0,0 @@
window.onload = function() {
var data = {}
change = function(_data) {
for(i in _data) {
data[i] = _data[i]
}
}
update = function() {
for (var i in data) {
if ($('#'+i).length < 1) {
var e = document.createElement('tr')
e.id = i
$('#cont tbody').append(e)
}
$('#'+i).html("<td>~"+i+"</td><td>"+data[i]+"</td>")
}
$('#cont tbody').append([].sort.call($('#cont tr'), function (a, b) {
return parseInt(b.childNodes[1].innerText) -
parseInt(a.childNodes[1].innerText)
}))
}
goof = function(e) {
d = $.map($(".sel"), function(el) {return el.id})
window.urb.send(d)
}
window.urb.send(null);
/*window.urb.subscribe("frog","goof",*/ function(err,res) {
if(err)
return console.log('cannot connect to frog/goof')
change(res.data)
update()
return true
})
$('#cont').on('click', 'tr', function (e) {
if (!e.ctrlKey) { $('.sel').removeClass('sel') }
$(this).addClass('sel')
})
}

View File

@ -1,116 +0,0 @@
!:
=> |%
++ axle
$% [%0 p=(map ,@p ,@ud)]
==
++ gilt
$% [%json p=json]
[%hymn p=manx]
==
++ gift
$% [%rust gilt]
[%nice gilt]
==
++ move ,[p=bone q=[%give p=gift]]
++ phil
$% [%new ~]
[%add p=(list ,@p)]
==
--
|_ [hid=hide vat=axle]
++ incl
|= wal=wall
%+ turn wal
|= tape ;script(type "text/javascript", src +<);
::
++ root
/(scot %p our.hid)/main/(scot %da lat.hid)/app/[app.hid]
::
++ respond :: respond to message
|= ost=bone
`move`[ost %give %nice %json *json]
::
++ update :: update subscribers
^- (list move)
%+ turn
^- (list bone)
%+ ~(rep by sup.hid) *(list bone)
|= [p=[p=bone q=[ship path]] q=(list bone)] ^- (list bone)
?. =(/goof +.q.p) q
[p.p q]
send-vat
::
++ render
^- manx
;html
;head
;title: Foobug!
;style
; .sel {background: lightgray}
; #cont {border-collapse: collapse}
==
;* %- incl :~
"//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"
==
;script ;- (trip ;;(,@ .^(%cx (welp root /urb/js))))
==
;script ;- (trip ;;(,@ .^(%cx (welp root /app/js))))
==
==
;body
;p: Yo.
;table#cont:tbody;
;p: Select a ship
;button(onclick "goof()"): Give 5 points
==
==
::
++ peer
|= [ost=bone you=ship pax=path]
^- [(list move) _+>]
:_ +>
?: =(/ pax)
[ost %give %rust %hymn render]~
[(send-vat ost) ~]
::
++ poke-phil
|= [ost=bone you=ship pil=phil]
=. p.vat
?- -.pil
%new (~(put by p.vat) you (fall (~(get by p.vat) you) _@ud))
%add %- ~(urn by p.vat)
|= [u=@p n=@ud]
?. (lien p.pil |=(a=@p =(a u)))
n
(add 5 n)
==
[[(respond ost) update] +>.$]
::
++ poke-json
|= [ost=bone you=ship jon=json]
~& [%poke-json jon]
%^ poke-phil ost you
^- phil
?+ -.jon !!
%o [%new ~]
%a :- %add
%+ turn p.jon
|= a=json
?> ?=([%s *] a)
(slav %p (cat 3 '~' p.a))
==
::
++ send-vat
|= ost=bone
=+ luz=(~(tap by p.vat) ~)
^- move
:* ost %give %rust %json %o
^- (map ,@t jval)
%- mo
%+ turn luz
|= [a=@p b=@ud]
:- (rsh 3 1 (scot %p a))
:- %n
(rsh 3 2 (scot %ui b))
==
--

View File

@ -1,111 +0,0 @@
window.urb = {
ship: ship,
port: port,
auto: auto,
oryx: oryx,
user: user,
appn: appn,
seqn: 0,
seqp: 1,
dely: 0,
req: function(method,url,data,json,cb) {
var xhr = new XMLHttpRequest()
xhr.open(method.toUpperCase(), url)
if(json)
xhr.setRequestHeader("content-type", "text/json")
if(data)
xhr.send(JSON.stringify(data))
else
xhr.send()
if(cb) {
xhr.onload = function() {
cb(null,{
"status":this.status,
"data":JSON.parse(this.responseText)
})
}
xhr.onerror = function() {
cb({
"status":this.status,
"data":this.responseText
})
}
}
},
subscribe: function(stream,path,cb) {
if(!cb)
throw new Error("You must supply a callback to urb.subscribe.")
var method, perm, url, $this
method = "post"
perm = "pis"
url = [this.ship,perm,this.user,this.appn,this.port]
if(stream) {
url.push(stream)
if(path)
url.push(path)
}
url = "/"+url.join("/")
$this = this
this.req(method,url,{},true,function(err,data) {
cb.apply(this,arguments)
if(!err) { $this.poll(stream,cb); }
})
},
send: function(data,cb) {
if(!data) { data = {}; }
if(!cb) { cb = function() {}; }
var method, perm, url, $this
method = "post"
perm = "pim"
url = [this.ship,perm,this.user,this.appn,this.port,this.seqn]
url = "/"+url.join("/")
this.seqn++
$this = this
this.req(method,url,data,true,function(err,data) {
if(err) { $this.seqn--; }
cb.apply(this,arguments)
})
},
poll: function(stream,cb) {
if(!stream)
throw new Error("You must supply a stream to urb.poll.")
if(!cb)
throw new Error("You must supply a callback to urb.poll.")
var method, perm, url, $this
method = "get"
perm = "gie"
if(!stream) { return false; }
url = [this.ship,perm,this.user,this.appn,this.port,stream,this.seqp]
url = "/"+url.join("/")
$this = this
this.req(method,url,null,false,function(err,data) {
if(cb.apply(this,arguments) === false) { return; }
if(err)
$this.dely += 1000
else {
$this.dely = 0
$this.seqp++
}
setTimeout(function() {
$this.poll(stream,cb)
},$this.dely)
})
}
}

View File

@ -1,45 +0,0 @@
!:
:: Read ::
|_ [hid=hide vat=tape]
++ peer
|= [ost=bone ship pax=path]
~& pax
?~ pax
$(pax ~[(rsh 3 1 (scot %p our.hid))])
?> ?=([cord ~] pax)
:_ +>.$
:~ [ost %pass /ret %g %show [(slav %p (cat 3 '~' i.pax)) %written] our.hid /]
:: :^ ost %pass /heyya
:: :^ %g %mess [(slav %p (cat 3 '~' i.pax)) %written]
:: :+ our.hid %json !>(`json`[%s %hola])
:: :^ ost %pass /heyya
:: :^ %g %mess [(slav %p (cat 3 '~' i.pax)) %written]
:: :+ our.hid %json !>(`json`[%s %buenos-dias])
:: :^ ost %pass /heyya
:: :^ %g %mess [(slav %p (cat 3 '~' i.pax)) %written]
:: :+ our.hid %json !>(`json`[%s %buenas-tardes])
:: :^ ost %pass /heyya
:: :^ %g %mess [(slav %p (cat 3 '~' i.pax)) %written]
:: :+ our.hid %json !>(`json`[%s %buenas-tardes])
==
++ pour
|= [pax=path sin=*]
:_ +>
?: =(/ret pax)
=+ sin=;;(,[%g p=@tas q=*] sin)
?: ?=(%nice p.sin)
~& %pour-nice ~
?: ?=(%mean p.sin)
~& %pour-mean ~
=+ sin=;;(,[%g p=@tas q=mark r=*] sin)
~& [%pour-ret p.sin q.sin]
=+ gif=;;(,[?(%rust %rush) %hymn manx] +.sin)
%+ turn (~(tap by sup.hid))
|= [ost=bone you=ship pax=path]
[ost give/gif]
?: =(/heyya pax)
~& [%pour-acked sin]
~
~& %pour-bad ~
--

View File

@ -1,49 +0,0 @@
!:
=> |%
++ gift
$% [%mean p=ares]
[%nice ~]
[%rust %hymn manx]
==
++ move ,[p=bone q=(mold note gift)]
++ note ,~
--
:: Write ::
|_ [hid=hide vat=tape]
++ root
[(crip <our.hid>) %main (crip <lat.hid>) ~]
::
++ page
:- %hymn
;html
;head
;title: Writer
;script:"{(trip (,@ (need (file (welp root /lib/urb/js)))))}"
==
;body
;p: Write things!
;+ =+ js="urb.send(\{appl:{<`@t`app.hid>}, data:texx.value})"
;textarea(id "texx", onchange js):"{vat}"
==
==
++ peer
|= [ost=bone you=ship pax=path]
:_ +>.$ :_ ~
:^ ost %give %rust
page
:: ^- [(list move) _+>]
:: :_ +>.$ :_ ~
:: [ost %give %rust page]
++ poke-json
|= [ost=bone you=ship jon=json]
^- [(list move) _+>]
=. vat (need (sa:jo jon))
~& [%poke-vat vat]
:_ +>.$
:* [ost %give %mean ~ %alan-kay ~[leaf/"is a failure"]]
~
:: %+ turn (~(tap by sup.hid))
:: |= [ost=bone you=ship pax=path]
:: [ost %give %rust page]
==
--