Skip to content

Instantly share code, notes, and snippets.

View emchateau's full-sized avatar

Emmanuel Château-Dutier emchateau

View GitHub Profile
@CliffordAnderson
CliffordAnderson / 01-lookup-words
Last active January 19, 2017 16:00
Looking up words in the OED with XQuery
xquery version "3.1";
let $word := "person"
let $request :=
<http:request href="https://od-api.oxforddictionaries.com/api/v1/entries/en/{$word}" method="get">
<http:header name="app_key" value="###"/>
<http:header name="app_id" value="###"/>
</http:request>
return http:send-request($request)
@xokomola
xokomola / example-table.xml
Created December 21, 2016 14:43
Create ODS Spreadsheet with XQuery and BaseX
<tables>
<table name="Sheet 1">
<thead>
<tr>
<td>A</td>
<td>B</td>
<td>C</td>
</tr>
</thead>
<tbody>
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
xquery version "3.1";
let $uri := "http://openlibrary.org/search.json?title=digital+humanities"
let $json := fetch:text($uri)
return $json
/*
This script uses Oxygen operation called JSOperation, see https://www.oxygenxml.com/doc/versions/18.0/ug-editorEclipse/topics/dg-default-author-operations.html.
For generating the personal access token to be used in this script, please select "public_repo | Access public repositories".
This script has to be put in the file ${framework}/commons.js.
In order to add the button for publishing to github, add the following code to any CSS file that is associated within the framework with the edited XML file:
rdf|RDF:before {
content: oxy_button(action, oxy_action(name, "Publish to github", operation, "ro.sync.ecss.extensions.commons.operations.JSOperation", arg-script, "function doOperation(){publishToGihub();}"))
}
*/
xquery version "3.1";
import module namespace http = "http://expath.org/ns/http-client";
(: For generating the personal access token to be used in this script, please select "public_repo | Access public repositories". :)
let $git-token := "<your-github-token>"
let $user-name := "<your-github-username>"
let $repo-name := "<your-repo-name>"
let $file-path := "<file=path>"
let $message := "<commit-message>"
let $new-file-content := serialize(<a/>)
@amowu
amowu / data-binding.js
Created October 5, 2016 04:16
How to Implement DOM Data Binding in Pure JavaScript
// http://stackoverflow.com/a/16484266/754377
function DataBind(element, data) {
this.data = data;
this.element = element;
element.value = data;
element.addEventListener("change", this, false);
}
DataBind.prototype.handleEvent = function(event) {
switch (event.type) {
@arthurattwell
arthurattwell / pandoc-docx-md.bat
Last active September 5, 2023 02:35
Script to convert docx to markdown with Pandoc
:: pandoc-docx-md.bat
::
:: Don't show these commands to the user
@ECHO off
:: Set the title of the window
TITLE Convert docx to markdown with Pandoc
:: Select file marker
:selectfile
:: Clear any preexisting filename variables
SET filename=
SELECT ?a ?lat ?long WHERE {
?a wdt:P31/wdt:P279* wd:Q811979 .
?a wdt:P131 wd:Q193826 .
?a p:P625 ?lieu . #
?lieu psv:P625 ?coordinate_node.
?coordinate_node wikibase:geoLatitude ?lat .
?coordinate_node wikibase:geoLongitude ?long .
}
#avoir lat + long dans une seule variable (séparé par une virgule)
@ewg118
ewg118 / RIC6-10.sparql
Last active July 19, 2017 17:38
SPARQL query of British Museum endpoint to get RIC 6, 7, 8, 10 coins for normalization
PREFIX bmo: <http://collection.britishmuseum.org/id/ontology/>
PREFIX crm: <http://erlangen-crm.org/current/>
PREFIX ecrm: <http://erlangen-crm.org/current/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX bibo: <http://purl.org/ontology/bibo/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?s ?regno ?mint ?auth ?ref WHERE {
{?s ecrm:P70i_is_documented_in <http://collection.britishmuseum.org/id/bibliography/3189>}