Created
April 28, 2014 21:12
Revisions
-
malgorithms created this gist
Apr 28, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,39 @@ var xhr = require('xhr') // Add something to requirebin for printing results var table = document.createElement("table"); document.body.appendChild(table); // // Look up a specific username on Keybase and append all their info // into our display table.... // lookup_user = function(username){ xhr ('https://keybase.io/_/api/1.0/user/lookup.json?username='+username, function(err, resp, body) { var data = JSON.parse(body); table.innerHTML += "<tr><td><h1><a href=\"https://keybase.io/"+username+"\">" + username + "</h1></td>" + "<td><pre style=\"overflow:scroll;height:200px;width:600px;font-size:0.8em;border:1px solid #ddd;\">" + JSON.stringify(data.them, null, 2) + "</pre></td></tr>"; }); } // // Find people on the site with a query on their username, twitter name, whatever. // search = function(q) { xhr ('https://keybase.io/_/api/1.0/user/autocomplete.json?q='+q, function(err, resp, body) { var data = JSON.parse(body); // for each one, look up their identities for (var i = 0; i < data.completions.length; i++) { var u = data.completions[i]; var username = u.components.username.val; lookup_user(username); } }); } // // do the search // search('chris'); This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ require=function e(t,n,r){function o(s,u){if(!n[s]){if(!t[s]){var a="function"==typeof require&&require;if(!u&&a)return a(s,!0);if(i)return i(s,!0);throw Error("Cannot find module '"+s+"'")}var p=n[s]={exports:{}};t[s][0].call(p.exports,function(e){var n=t[s][1][e];return o(n?n:e)},p,p.exports,e,t,n,r)}return n[s].exports}for(var i="function"==typeof require&&require,s=0;r.length>s;s++)o(r[s]);return o}({o4EXtA:[function(e,t){function n(e,t){function n(){4===c.readyState&&o()}function o(){var e=null,n=c.statusCode=c.status,r=c.body=c.response||c.responseText||c.responseXML;if(0===n||n>=400&&600>n){var o=c.responseText||s[(c.status+"").charAt(0)];e=Error(o),e.statusCode=c.status}if(x)try{r=c.body=JSON.parse(r)}catch(i){}t(e,c,r)}function p(e){t(e,c)}"string"==typeof e&&(e={uri:e}),e=e||{},t=i(t);var c=e.xhr||null;!c&&e.cors?c=new a:c||(c=new u);var f=c.url=e.uri||e.url,d=c.method=e.method||"GET",l=e.body||e.data,h=c.headers=e.headers||{},y=!!e.sync,x=!1;return"json"in e&&(x=!0,h["Content-Type"]="application/json",l=JSON.stringify(e.json)),c.onreadystatechange=n,c.onload=o,c.onerror=p,c.onprogress=function(){},c.ontimeout=r,c.open(d,f,!y),e.cors&&(c.withCredentials=!0),y||(c.timeout="timeout"in e?e.timeout:5e3),c.setRequestHeader&&Object.keys(h).forEach(function(e){c.setRequestHeader(e,h[e])}),"responseType"in e&&(c.responseType=e.responseType),c.send(l),c}function r(){}var o=e("global/window"),i=e("once"),s={0:"Internal XMLHttpRequest Error",4:"4xx Client Error",5:"5xx Server Error"},u=o.XMLHttpRequest||r,a="withCredentials"in new u?o.XMLHttpRequest:o.XDomainRequest;t.exports=n},{"global/window":3,once:4}],xhr:[function(e,t){t.exports=e("o4EXtA")},{}],3:[function(e,t){(function(e){t.exports="undefined"!=typeof window?window:e!==void 0?e:{}}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],4:[function(e,t){function n(e){var t=!1;return function(){return t?void 0:(t=!0,e.apply(this,arguments))}}t.exports=n,n.proto=n(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return n(this)},configurable:!0})})},{}]},{},[]);var xhr=require("xhr"),table=document.createElement("table");document.body.appendChild(table),lookup_user=function(e){xhr("https://keybase.io/_/api/1.0/user/lookup.json?username="+e,function(t,n,r){var o=JSON.parse(r);table.innerHTML+='<tr><td><h1><a href="https://keybase.io/'+e+'">'+e+"</h1></td>"+'<td><pre style="overflow:scroll;height:200px;width:600px;font-size:0.8em;border:1px solid #ddd;">'+JSON.stringify(o.them,null,2)+"</pre></td></tr>"})},search=function(e){xhr("https://keybase.io/_/api/1.0/user/autocomplete.json?q="+e,function(e,t,n){for(var r=JSON.parse(n),o=0;r.completions.length>o;o++){var i=r.completions[o],s=i.components.username.val;lookup_user(s)}})},search("chris"); This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,7 @@ { "name": "requirebin-sketch", "version": "1.0.0", "dependencies": { "xhr": "1.5.0" } } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,2 @@ <style type='text/css'>html, body { margin: 0; padding: 0; border: 0; } body, html { height: 100%; width: 100%; }</style> This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ made with [requirebin](http://requirebin.com)