Skip to content

Instantly share code, notes, and snippets.

View crichey's full-sized avatar

Clark D. Richey, Jr. crichey

View GitHub Profile
@crichey
crichey / roxy-maven.xml
Last active August 29, 2015 13:57
Maven snippet for Roxy integration
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2</version>
<executions>
<execution>
<id>clean modules</id>
<configuration>
<workingDirectory>${basedir}/../marklogic</workingDirectory>
<executable>./ml</executable>
@crichey
crichey / default.xqy
Created February 29, 2012 19:26
tutorial 2 default
xdmp:set-response-content-type("text/html"),
('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">',
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>My first Mark Logic web page</title>
</head>
<body>
<p>Hello World!</p>
</body>
</html>)
@crichey
crichey / default2.xqy
Created February 29, 2012 19:10
tutorial 2 default 2
xdmp:set-response-content-type("text/html"),
('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">',
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>My first Mark Logic web page</title>
</head>
<body>
<p>Hello World! This application is running on MarkLogic Server version {xdmp:version()}</p>
</body>
</html>)
@crichey
crichey / gist:1903593
Created February 24, 2012 20:38
Shakespeare
for $speech in doc()//SPEECH
let $speaker := $speech/SPEAKER
let $lines := $speech/LINE
return (
<h2>{$speaker/text()}</h2>,
<p>{for $line in $lines return $line/text()}</p>
)
declare function app:cluster() as element(li)*
{
if ($config:RESPONSE/search:result) then
let $docs :=
for $uri in $config:RESPONSE/search:result/@uri
return fn:doc($uri)
let $cluster-nodes := cts:cluster($docs,
<options xmlns="cts:cluster">
<algorithm>lsi</algorithm>
</options>)
declare function app:sidebar()
as element(div)?
{
let $view := $config:CONTEXT/*:view
return
if ($view = ("help","contact","terms"))
then ()
else
<div class="sidebar" arcsize="5 5 0 0">
<div class="sidebar-background" arcsize="5 0 0 5" border="rgb(222,222,222)" id="sidebar_background">&nbsp;</div>
declare function app:sidebar()
as element(div)?
{
let $view := $config:CONTEXT/*:view
return
if ($view = ("help","contact","terms"))
then ()
else
<div class="sidebar" arcsize="5 5 0 0">
<div class="sidebar-background" arcsize="5 0 0 5" border="rgb(222,222,222)" id="sidebar_background">&nbsp;</div>