This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html ng-app><head> | |
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"> | |
<title>Angular.js Nested Repeatable Objects</title> | |
<style> | |
#section-form { margin: auto; width: 960px; } | |
.section { border: 2px solid #999; margin: 10px 0; padding: 10px; } | |
.section > label { display: inline-block; padding-right: 10px; text-align: right; vertical-align:top; width: 150px; } | |
.question { background: #eee; border: 2px solid #aaa; margin: 5px 0; padding: 10px; } | |
#fader { position:fixed; top: 0px; left: 0px; width: 100%; height:100%; background-color: black; opacity: 0.8; z-index: 3; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xquery version "3.0" encoding "UTF-8"; | |
(:~ return image metadata as xml using http://drewnoakes.com/code/exif/ | |
: usage: metadata:read('C:/temp/apic.jpg') | |
: xml format based on xmlcalabash1 | |
: https://github.com/ndw/xmlcalabash1/blob/master/src/com/xmlcalabash/extensions/MetadataExtractor.java | |
: @author andy bunce | |
:) | |
module namespace metadata = 'apb.image.metadata'; | |
declare default function namespace 'apb.image.metadata'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let $s:=" | |
import module namespace test = 'org.apb.modules.TestModule'; | |
declare function local:prime($n){ | |
$n = 2 or ($n > 2 and | |
(every $d in 2 to xs:integer(math:sqrt($n)) satisfies $n mod $d > 0)) | |
}; | |
let $t:=test:startTimeout(xs:int(10000)) | |
return count((1 to 1000000)[local:prime(.)]) | |
" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(:~ | |
: tail recursion example | |
:) | |
declare function local:sum-a($n){ | |
if($n eq 0) then 1 else $n+ local:sum-a($n - 1) | |
}; | |
declare function local:sum-b($n){ | |
local:sum-iter(1,$n) | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare function local:result($id){ | |
try{ | |
map{ "result":async:result($id) | |
} | |
} catch * { | |
map{ "error": map { | |
'code': $err:code, | |
'description': $err:description, | |
'module': $err:module, | |
'line': $err:line-number, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare namespace trang="java:com.thaiopensource.relaxng.translate.Driver"; | |
trang:new()=> trang:run( | |
("C:\Users\andy\git\qd-cmpx\src\main\content\components.rnc" | |
,"C:\Users\andy\git\qd-cmpx\src\main\content\output.xsd") | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(: ebnf to Java parser for BaseX using REx :) | |
declare function local:REx-request($ebnf as xs:string,$name as xs:string,$command as xs:string)as item()+{ | |
let $req:= | |
<request xmlns="http://expath.org/ns/http-client" href='http://www.bottlecaps.de/rex/' method="post"> | |
<multipart media-type="multipart/form-data" boundary="xyzBouNDarYxyz"> | |
<header name="Content-Disposition" value='form-data; name="command"'/> | |
<body media-type="text/plain"/> | |
<header name="Content-Disposition" value='form-data; name="input"; filename="{$name}.ebnf"'/> | |
<body media-type="text/plain"/> | |
</multipart> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Andy bunce jan 2013 based on http://book.mixu.net/ch13.html | |
var fs = require('fs'), | |
http = require('http'), | |
sio = require('socket.io'); | |
var port=8001; | |
var server = http.createServer(function(req, res) { | |
res.writeHead(200, { 'Content-type': 'text/html'}); | |
res.end(fs.readFileSync('./index.html')); | |
}); | |
server.listen(port, function() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module namespace page = 'http://basex.org/modules/web-page'; | |
declare | |
%rest:path("content") | |
%rest:produces("application/json") | |
%output:method("json") | |
function page:content1(){ | |
<json type="object"> | |
<msg>Hello</msg> | |
</json> | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(: https://libertyseeds.ca/2015/07/21/Investigating-Final-Draft-s-XML-document-format-with-Ruby/ :) | |
declare function local:update($result as map(*),$next as element()) as map(*) | |
{ | |
let $name:=name($next) | |
let $current:=$result($name) | |
let $atribs:=$next/@*[if(empty($current)) then true() else not( .=$current(name(.)))] | |
let $atribs:=map:merge(($current, $atribs!map:entry(name(.),string(.))), map{'duplicates': 'combine'}) | |
return map:put($result,$name,$atribs) | |
}; |