Skip to content

Instantly share code, notes, and snippets.

View kurtcagle's full-sized avatar

Kurt Cagle kurtcagle

  • Semantical LLC
  • Bellevue, WA 98006
  • 12:31 (UTC -07:00)
View GitHub Profile
person:_JaneDoe a class:_Person;
person:isMemberOf org:_Shield;
person:hasGender gender:_Female;
person:hasBirthDate "1993-03-16"^^xsd:date;
.
<<person:_JaneDoe person:isMemberOf org:_Shield>> owl:sameAs _:JaneDoeMemberShield.
<<person:_JaneDoe person:hasBirthDate "1993-03-16"^^xsd:date>> owl:sameAs _:JaneDoeBirthDate.
_:JaneDoeMemberShield
a class:_Statement;
statement:hasConfidenceLevel "0.75"^^unit:_Percent;
<html>
<head>
</head>
<body>
<div id="card"></div>
</body>
<script src="https://gist.githubusercontent.com/kurtcagle/206be48bfa4901c8f3d34cdf54497544/raw/3a95efdf0cb3c628fa287c2c87056f416ee6b934/templates.js">/**/</script>
<script src="https://gist.githubusercontent.com/kurtcagle/7f970884db8a7054b259643254800119/raw/e7c8d8437a241c080b368027b28c6fe25ceac2a3/npc.js">/**/</script>
<script>
@kurtcagle
kurtcagle / npc.js
Created April 16, 2018 00:14
An NPC file.
var npc = {
name:"Jane Doe",
properties:[
{label:"Vocation",value:"writer",key:"vocation",datatype:"string"},
{label:"Gender",value:"female",key:"gender",datatype:"string"},
{label:"Setting",value:"1910s Edwardian Mystery",key:"setting",datatype:"string"},
{label:"Age",value:24,key:"age",datatype:"integer"},
{label:"Description",key:"description",datatype:"extString",value:"Miss Doe is a writer of mystery novels whose sometimes flighty demeanor disguises a keen intellect and excellent powers of observation."},
{label:"Image",value:"https://s3-us-west-2.amazonaws.com/s.cdpn.io/620300/Laura.png",key:"image",
datatype:"image"}
@kurtcagle
kurtcagle / templates.js
Created April 16, 2018 00:10
Templates Javascript template literals.
var templates = {
npcTemplate:(npc)=>`<article class="example">
<header><h1>${npc.name}</h1></header>
<div class="propertyList">
${npc.properties.map((property)=>property.datatype==='image'?
templates.imageTemplate(property):
templates.propertyTemplate(property)).join('\n')}
</div>
</article>`,
propertyTemplate:(property)=>`<div class="property">
@kurtcagle
kurtcagle / Converting Turtle to JSON-LD
Created October 18, 2017 00:30
This is a VERY preliminary example of an n3/json-ld conversion packet. I need to formalize it, but putting this up as a quick and dirty reference.
const jsonld = require("jsonld");
var N3 = require('N3');
var parser = N3.Parser();
var turtle = `
@prefix class: <http://semanticalllc.com/ns/Class/>.
@prefix person: <http://semanticalllc.com/ns/Person/>.
@prefix name: <http://semanticalllc.com/ns/Name/>.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
@prefix schema: <http://schema.org/>.
@kurtcagle
kurtcagle / helloWorldTest.html
Created July 16, 2017 13:56
Hello World with Web Components
<html>
<style>
hello-world {display:none;cursor:pointer;}
</style>
<body>
<hello-world id="item0"></hello-world>
<hello-world id="item1" color1="red" greetings="Hello" target="Mars">${props.greetings}, ${props.target}</hello-world>
<hello-world id="item2" color1="red" color2="maroon" greetings="Guten Tag">${props.greetings}, "${props.target}"! color1 is ${props.color1}, color2 is ${props.color2}</hello-world>
<hello-world id="item3" color1="gray" color2="navy" greetings="Aloha">${props.greetings}, "${props.target}"!</hello-world>
@kurtcagle
kurtcagle / xforms2.xml
Last active September 28, 2020 23:13
xforms2.xml
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="/js/xsltforms/xsltforms.xsl"?>
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:d="http://semantical.com/ns/data/"
>
<head>
<xf:model id="main">
@kurtcagle
kurtcagle / Xforms1.xml
Last active March 20, 2016 19:57
Xforms1
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="/js/xsltforms/xsltforms.xsl"?>
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:ev="http://www.w3.org/2001/xml-events"
>
<head>
<xf:model id="main">
<xf:instance id="data">
@kurtcagle
kurtcagle / Car.rdf.xml
Created March 16, 2016 18:37
Car.rdf.xml
<class:Car about="car:BlueCar">
<color>blue</color>
</class:Car>
<class:CarState about="carState:BlueCar_1">
<time>0</time>
<x>0</x>
<vx>0</vx>
<gas>10</gas>
<stateOf resource="car:BlueCar"/>
</class:CarState>
@kurtcagle
kurtcagle / Car.xsd
Created March 16, 2016 09:56
Car.xsd
<xs:schema>
<xs:complexType name="Car_Type">
<xs:sequence>
<xs:element name="color" type="xs:string"/>
<xs:element name="CarStatus" type="CarStatus_Type" minOccurs="1" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="CarStatus_Type">
<xs:sequence>
<xs:element name="time" type="xs:integer"/>