Skip to content

Instantly share code, notes, and snippets.

@melvincarvalho
Created July 30, 2019 12:18
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save melvincarvalho/fbed989225780bb54ef466c99129dd83 to your computer and use it in GitHub Desktop.
Save melvincarvalho/fbed989225780bb54ef466c99129dd83 to your computer and use it in GitHub Desktop.
add bookmark
const user = 'https://melvincarvalho.com/#me';
const time = new Date().toISOString();
const title = document.title;
const recalls = location.href;
const ms = Math.floor(Math.random() * 1000);
const uri = time.substring(0,4) + time.substring(5,7) + time.substring(8,10) + time.substring(11,13) + time.substring(14,16) + time.substring (17,19) + "." + ms;
console.log(`
<> <http://purl.org/dc/terms/references> <#${uri}> .\n
\n
<#${uri}>\n
a <http://www.w3.org/2002/01/bookmark#Bookmark>;\n
<http://purl.org/dc/terms/created> "${time}"^^XML:dateTime;\n
<http://purl.org/dc/terms/title> "${title}";\n
<http://www.w3.org/2002/01/bookmark#recalls> <${recalls}>;\n
<http://xmlns.com/foaf/0.1/maker> <${user}> .\n
`);
@melvincarvalho
Copy link
Author

melvincarvalho commented Jul 30, 2019

const user = 'https://melvincarvalho.com/#me';
const time = new Date().toISOString();
const title = document.title;
const recalls = location.href;
const ms = Math.floor(Math.random() * 1000);
const uri = time.substring(0,4) + time.substring(5,7) + time.substring(8,10) + time.substring(11,13) + time.substring(14,16) + time.substring (17,19) + "." + ms;
console.log(`
<> http://purl.org/dc/terms/references <#${uri}> .\n
\n
<#${uri}> http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://www.w3.org/2002/01/bookmark#Bookmark .\n

<#${uri}> http://purl.org/dc/terms/created "${time}"^^http://www.w3.org/2001/XMLSchema#dateTime .\n
<#${uri}> http://purl.org/dc/terms/title "${title}" .\n
<#${uri}> http://www.w3.org/2002/01/bookmark#recalls <${recalls}> .\n
<#${uri}> http://xmlns.com/foaf/0.1/maker <${user}> .\n
`);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment