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 / RDF patch
Created October 4, 2011 21:51
RDF patch
curl -X PATCH -H 'Content-Type: application/json' -d '{
"http://data.melvin.me/test.ttl#me": {
"http://xmlns.com/foaf/0.1/givenname" : [ { "value" : "Melvin",
"type" : "literal" } ]
}
} ' data.melvin.me/test.ttl
@melvincarvalho
melvincarvalho / SPARQL INSERT
Created October 5, 2011 19:55
SPARQL INSERT
curl -H 'Content-type: application/sparql-query' -d 'INSERT DATA { <http://melvster.data.fm/foaf#me> <http://xmlns.com/foaf/0.1/age> 37 . }' http://melvincarvalho.data.fm/foaf
@melvincarvalho
melvincarvalho / GPG -> WebID convertor
Created December 21, 2011 10:58
GPG -> WebID convertor
package net.java.dev.sommer.foafserver.utils;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.math.BigInteger;
import java.security.InvalidKeyException;
import java.security.KeyStore;
import java.security.KeyStoreException;
@melvincarvalho
melvincarvalho / foaf knows
Created December 23, 2011 13:12
foaf knows
URI="http://bblfish.net/people/henry/card#me"
roqet -r turtle --exec "CONSTRUCT {
<$URI> <http://xmlns.com/foaf/0.1/knows> ?c . ?c <http://xmlns.com/foaf/0.1/name> ?n } WHERE { <$URI> <http://xmlns.com/foaf/0.1/knows> ?c . ?c <http://xmlns.com/foaf/0.1/name> ?n }" -D "$URI"
@melvincarvalho
melvincarvalho / Get email from browserID assertion
Created January 28, 2012 17:34
Get email from browserID assertion
var arr = assertion.split('.');
var f = JSON.parse(window.atob(arr[1]));
alert( f['principal']['email'] );
@melvincarvalho
melvincarvalho / CORS request
Created February 2, 2012 08:28
CORS request
// Create the XHR object.
function createCORSRequest(method, url) {
var xhr = new XMLHttpRequest();
if ("withCredentials" in xhr) {
// XHR for Chrome/Safari/Firefox.
xhr.open(method, url, true);
} else if (typeof XDomainRequest != "undefined") {
// XDomainRequest for IE.
xhr = new XDomainRequest();
xhr.open(method, url);
@melvincarvalho
melvincarvalho / retroshare
Created February 21, 2012 09:47
retroshare
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.11 (GNU/Linux)
mQENBE3ZoEcBCADXmHWK/QhE82aPiOco5zWzTpRwbbzcerhYMUArsEOohQin18Tr
Ri2v2Rfm0wWPWVl8VHOfgwu/+f9ddAyQasSA7+PhydCo5X3oGph6f9DBtotLTKHk
NK7AfE9DzQSKhuCF0o9ps+l8hE067bdJwnNjnwq/7z1YKf6FZ3s0NkcBEy5EWbla
zDNHBPgMTePg558hrPKCxAHnPn5Xf7vBlakRMuIVxBEZG648Z+0cPRKTSpqFE7vo
qvxuAkcBoVlbhIwf5bX2rJOJHjOePRgdSLOleuhitQCWpAVw3eez+p8UmnL1vH1d
wgCZzSYBXiD389xhG2byx4SZfZk7mJnHr9JfABEBAAG0Kk1lbHZpbiBDYXJ2YWxo
byA8bWVsdmluY2FydmFsaG9AZ21haWwuY29tPokBOAQTAQIAIgUCTdmgRwIbAwYL
@melvincarvalho
melvincarvalho / gist:1932837
Created February 28, 2012 14:27
webfinger simplification
## Simplification
joe@gmail.com and translate to -> gmail.com/@/joe
Serve it as JSON, and we're pretty much done (ive skipped a couple of details for brevity).
We have a few world class, scalable, JSON formats now that we didnt have 2 years ago.
## Current webfinger
/**
* @fileOverview
*
* rdfapi - see: <http://webr3.org/apps/play/api/lib>
*
* @author Nathan <http://webr3.org/nathan#me>
* @version 2010-10-29T03:30:00Z
* @license http://creativecommons.org/publicdomain/zero/1.0/
*
* source: <http://webr3.org/apps/play/api/> To the extent possible under law,
@melvincarvalho
melvincarvalho / semantic pingback
Created May 30, 2012 14:16
semantic pingback
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" xmlns:pingback="http://purl.org/net/pingback/">
<head>
<title>Pingback Service</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
</head>
<body typeof="pingback:Container">
<form method="post" action="">
<p>source: <input type="text" property="pingback:source" name="source" /></p>
<p>target: <input type="text" property="pingback:target" name="target" /></p>