Skip to content

Instantly share code, notes, and snippets.

View scaleupcto's full-sized avatar

Chris Clarke scaleupcto

View GitHub Profile
<html>
<body>
<script src='https://www.workable.com/assets/embed.js' type='text/javascript'></script>
<script type='text/javascript' charset='utf-8'>
whr(document).ready(function(){
whr_embed(13317, {detail: 'titles', base: 'jobs', zoom: 'country', grouping: 'none'});
});
</script>
<div id="whr_embed_hook"></div>
</body>
@scaleupcto
scaleupcto / gist:948b6f8a5d8d83408bb4
Last active August 29, 2015 14:06
Tripod api v2 spitball

v1 API problems

  • $config only one at a time due to static setting
  • Options and configurations a mess - $config file, $opts in constructor and working db/collection via constructor.
  • Overly verbose getTripodTables() instead of tables
  • Inconsistent - for example table API has $SpecId as first param, whereas in views API it is the last param
  • Not namespaced

Setup:

app.use(function (req, res, next) {
if (req.headers['Content-Type']==="multipart") { // not quite right, but you get the gist
return multipartyMiddleware; // can't remember what your doc said to do here, but do that
} else {
return express.bodyParser();
}
});
var http = require('http');
app.get('/my/tn/upload/endpoint',function(req,res) {
var depotJSON = null;
var depotRequest = http.createRequest(depotOptions,function(depotResponse) {
var str = ""; // this will be the return body from DEPOT
depotResp.on('data', function(chunk){
str += chunk;
});
depotResp.on('end', function(){
var http = require('http');
app.get('/my/tn/upload/endpoint',function(req,res) {
var depotRequest = http.createRequest(....)
// handler for receving a chunk of file from web app
req.on('data', function(chunk) {
depotRequest.write(chunk); // send a chunk at a time to depot, see http://nodejs.org/api/http.html#http_request_write_chunk_encoding
});
req.on('end',function() {
{
"ntu" : {
"name":"Nottingham Trent University",
"apps": {
"rl" : "http://resourcelists.ntu.ac.uk/login.html",
"dc" : "http://content.talisaspire.com/ntu"
}
},
"manc" : {
"name":"University of Manchester",
db.raw_data.aggregate(
{ $match:{"_id.s":"1234-5678"}},
{ $project :
{
s: "$_id.s",
res: { d: "$_id.d", v: "$v"},
dt: 1
}
},
{
{_id:{s:'1234-5678',d:'5678-1234'},dt:['Book'],v:0.31}
{_id:{s:'1234-5678',d:'5678-1235'},dt:['Book'],v:0.12}
{_id:{s:'1234-5678',d:'5678-1236'},dt:['Book'],v:0.73}
{_id:{s:'1234-5678',d:'5678-1237'},dt:['Book'],v:0.4}
{_id:{s:'1234-5678',d:'5678-1238'},dt:['Book','SomeType'],v:0.1}
{_id:{s:'1234-5678',d:'5678-1239'},dt:['Website'],v:0.21}
{_id:{s:'1234-5678',d:'5678-1240'},dt:['Article'],v:0.42}
{_id:{s:'1234-5678',d:'5678-1241'},dt:['Article'],v:0.342}