Skip to content

Instantly share code, notes, and snippets.

View melvincarvalho's full-sized avatar
💭
I may be slow to respond.

Melvin Carvalho melvincarvalho

💭
I may be slow to respond.
View GitHub Profile
@melvincarvalho
melvincarvalho / post sparql update
Created June 17, 2012 13:04
post sparql update
postFile = function(file, data) {
if (typeof XMLHttpRequest == "undefined")
XMLHttpRequest = function () {
try { return new ActiveXObject("Msxml2.XMLHTTP.6.0"); }
catch (e) {}
try { return new ActiveXObject("Msxml2.XMLHTTP.3.0"); }
catch (e) {}
try { return new ActiveXObject("Microsoft.XMLHTTP"); }
catch (e) {}
//Microsoft.XMLHTTP points to Msxml2.XMLHTTP and is redundant
<div xmlns="http://www.w3.org/1999/xhtml"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xmlns:gr="http://purl.org/goodrelations/v1#"
xmlns:foaf="http://xmlns.com/foaf/0.1/">
<div typeof="gr:Offering" about="#offering">
<div rev="gr:offers" resource="#company"></div>
<div property="gr:name" content="http://www.ebusiness-unibw.org/tools/grsnippetgen/" xml:lang="en"></div>
@melvincarvalho
melvincarvalho / MyProfile
Created July 10, 2012 09:46
command line to MyProfile
#!/usr/bin/env python
import urllib
import httplib2
cert_file = 'e.pem'
http = httplib2.Http(disable_ssl_certificate_validation=True)
http.add_certificate('', cert_file, domain='')
@melvincarvalho
melvincarvalho / gist:3847704
Created October 7, 2012 09:48
webid apache mod compliation
To Compile mod_authn_webid / mod_authz_webid / mod_auth_everyone
1. Follow Instructions in README -- you may need to install some packages e.g.
sudo apt-get update
sudo apt-get install autoconf gcc pkg-config libssl-dev librdf-dev apache2-threaded-dev
2. Download files from http://dig.csail.mit.edu/2009/mod_authn_webid/
@melvincarvalho
melvincarvalho / rww 0.1
Created October 28, 2012 12:02
rww 0.1
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
<#1>
<http://www.w3.org/ns/auth/acl#accessTo> <https://test-rww.data.fm> ;
<http://www.w3.org/ns/auth/acl#agent> <http://melvincarvalho.com/#me> ;
<http://www.w3.org/ns/auth/acl#mode> <http://www.w3.org/ns/auth/acl#Read>, <http://www.w3.org/ns/auth/acl#Write> .
<#2>
<http://www.w3.org/ns/auth/acl#accessTo> <> ;
<http://www.w3.org/ns/auth/acl#agent> <http://melvincarvalho.com/#me> ;
@melvincarvalho
melvincarvalho / file ops
Created October 28, 2012 14:13
file ops
function deleteFile(file) {
var body = '';
xhr = new XMLHttpRequest();
xhr.open('DELETE', file, false);
xhr.setRequestHeader('Content-Type', 'text/turtle; charset=UTF-8');
xhr.send(body);
}
function putFile(file, data) {
xhr = new XMLHttpRequest();
$(function () {
"use strict";
// for better performance - to avoid searching in DOM
var content = $('#content');
var input = $('#input');
var status = $('#status');
// my color assigned by the server
var myColor = false;
@melvincarvalho
melvincarvalho / gist:6037600
Last active December 19, 2015 23:49
Creating a Tabulator Pane
tabulator.panes.register( {
icon: tabulator.Icon.src.icon_mbpost,//This icon should be defined in icons.js
label: function(subject) { //'subject' is the source of the document
if (true) {
return "MicroblogPost"; //The icon text
} else {
return null;
}
},
tabulator.panes.register( {
icon: tabulator.Icon.src.icon_mbPost,//This icon should be defined in icons.js
label: function(subject) { //'subject' is the source of the document
var SIOCt = tabulator.rdf.Namespace('http://rdfs.org/sioc/types#');
if (tabulator.kb.whether(subject, tabulator.ns.rdf('type'), SIOCt('MicroblogPost'))) {
return "MicroblogPost"; //The icon text
} else {
return null;
}
@melvincarvalho
melvincarvalho / gist:6962026
Created October 13, 2013 12:55
Create a ledger from HTML table
for (i=0,s=''; i<$('.s0').length; i++) s+=('<#p_' + i + '> a <http://xmlns.com/foaf/0.1/Person> ; <http://xmlns.com/foaf/0.1/name> "' + $('.s0')[i].textContent + '" . <#l_'+ i +'> a <https://payswarm.com/vocabs/commerce#Transfer> ; <https://payswarm.com/vocabs/commerce#destination> <#p_'+ i +'> ; <https://payswarm.com/vocabs/commerce#amount> ' + $('.s1')[i].textContent + ' .\n' ); console.log(s);
putFile('FILE', s);