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 / manifest.json
Created March 29, 2022 20:06 — forked from greatghoul/manifest.json
Chrome Extension Sample - detect if an extension is installed.
{
"name": "Detect if an extension installed",
"description": "Detect if an extension installed",
"version": "0.1",
"manifest_version": 2,
"permissions": [
"management"
],
"browser_action": {
"default_popup": "popup.html"
// ==UserScript==
// @name Trello Lists Show Num Cards
// @namespace http://use.i.E.your.homepage/
// @version 0.1
// @description enter something useful
// @match https://trello.com/b/*
// @copyright 2012+, You
// @require http://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js
// ==/UserScript==
setTimeout(function() {
@eedeebee
eedeebee / qbe-json-ex.java
Created February 1, 2014 05:33
MarkLogic Java API QBE for JSON
// create a search definition
StringHandle handle = new StringHandle(
"{ \"$query\": { \"plenary\": true } }"
).withFormat(Format.JSON);
RawQueryByExampleDefinition query = queryMgr.newRawQueryByExampleDefinition(handle);
// create a handle for the search results
StringHandle resultsHandle = new StringHandle().withFormat(Format.JSON);
@eedeebee
eedeebee / ex001.java
Created February 1, 2014 00:32
MarkLogic Java Tutorial Examples as of V7
// Create a search definition
StringHandle handle = new StringHandle(
"<q:qbe xmlns:q=\"http://marklogic.com/appservices/querybyexample\">\n" +
" <q:query>\n" +
" <PLAY>\n" +
" <PERSONAE>\n" +
" <PERSONA><q:word>brother</q:word></PERSONA>\n" +
" </PERSONAE>\n" +
" </PLAY>\n" +
" </q:query>\n" +
for $speech in (doc()//SPEECH)[1 to 100]
let $speaker := $speech/SPEAKER
let $lines := $speech/LINE
return (
<h2>{$speaker/text()}</h2>,
<p>{for $line in $lines return $line/text()}</p>
)
{
"options": {
"debug": false,
"transform-results": {
"apply": "raw"
},
"constraint": [{
"name": "stars",
"range": {
"type": "xs:int",
@eedeebee
eedeebee / grouping.xqy
Created January 7, 2014 17:39
Grouping the values from a range index
xquery version "1.0-ml";
declare namespace sample = "http://marklogic.com/sample";
let $groupsize := 1000
let $values := cts:element-values(xs:QName("sample:value"))
let $count := fn:count($values)
let $groups :=
for $i in (0 to (xs:int($count div $groupsize) + 1))
let $group := $values[(($i * $groupsize) + 1) to (($i + 1) * $groupsize)]
return fn:string-join($group, "|")
@eedeebee
eedeebee / tweet_options.xml
Created January 3, 2014 22:11
Search options for tweet and telephone fields, with suggestion source
<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>
<constraint name="tweet">
<word>
<field name="tweet"/>
</word>
</constraint>
@eedeebee
eedeebee / tweet_options.xml
Last active January 2, 2016 03:59
Search options for fields with tweet and telephone #s
<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>
<constraint name="tweet">
<word>
<field name="tweet"/>
</word>
</constraint>
@eedeebee
eedeebee / tweet_options.xml
Created January 3, 2014 21:53
Search options with word field constraint
<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>
<constraint name="tweet">
<word>
<field name="tweet"/>
</word>
</constraint>