Skip to content

Instantly share code, notes, and snippets.

View eedeebee's full-sized avatar

Eric Bloch eedeebee

  • Hillsborough, CA
View GitHub Profile
@eedeebee
eedeebee / corona.js
Last active October 11, 2015 06:08
Search APIs
// TODO: transform for results
jQuery.ajax({
url: host + "/search",
username: "foo:bar",
type: "POST",
data: {
length: 10,
structuredQuery: {
and: [
@eedeebee
eedeebee / get.js
Created March 26, 2013 18:18
MLDB Samples
var db = new mldb(); // default options
var doc = db.get("/messages/1", function(result) {
logger.debug("Doc content: " + JSON.stringify(result.doc));
});
@eedeebee
eedeebee / create.php
Created March 26, 2013 18:23
MLPHP Sample Usage
<?php
$document = new Document($client);
$document->setContentFile('myfile.xml')->write('/myfile.xml');
?>
declare variable $RESOURCE-URL := "@ml.resource-url";
(: Becomes... :)
declare variable $RESOURCE-URL := "http://some.resource.com";
xquery version "1.0-ml";
module namespace addr="http://example.org/address";
declare namespace rxq="http://exquery.org/ns/restxq";
declare
%rxq:GET
%rxq:path('/address/id/(.*)')
%rxq:produces('text/html')
function addr:get-address($id){
@eedeebee
eedeebee / bbq.xqy
Created December 11, 2013 21:51
MarkLogic XQuery Search API - 5 minute guide - data loader
xquery version "1.0-ml";
import module namespace admin = "http://marklogic.com/xdmp/admin" at "/MarkLogic/admin.xqy";
(
let $config := admin:get-configuration()
let $dbid := xdmp:database("barbecue")
let $rangespec :=
admin:database-range-element-attribute-index("dateTime",
"http://example.com", "entry", "", "date",
"", fn:false() )
@eedeebee
eedeebee / 0_reuse_code.js
Created December 18, 2013 00:21
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@eedeebee
eedeebee / tweet-1.xml
Last active December 31, 2015 16:39
Sample tweets
<doc>
<user>spacecadet47</user>
<mobile>(650)701-1212</mobile>
<impact-score>45.21</impact-score>
<dt>2013-11-01T12:00:22</dt>
<location lat="34.156111" long="-118.1319443">Pasadena</location>
<tweet>@NASA thanks for inviting me to the social! I'm learning so much!</tweet>
</doc>
@eedeebee
eedeebee / default-search-results.xml
Last active December 31, 2015 16:48
Tweet search results
<tweet>@NASA thanks for inviting me to the social! I'm learning so much!</tweet>
<tweet>Rumour has it NASA is announcing MSL finding organic carbon at press conference Tuesday.</tweet>
<tweet>Streambed on Mars! #NASA #MSL</tweet>
@eedeebee
eedeebee / query-plan-search-options.xml
Last active December 31, 2015 16:49
Query plan search options
<options xmlns="http://marklogic.com/appservices/search">
<search-option>unfiltered</search-option>
<quality-weight>0</quality-weight>
<return-plan>true</return-plan>
<debug>true</debug>
</options>