Skip to content

Instantly share code, notes, and snippets.

{
"category": "s_exp",
"components": [
"+"
],
"implementation": "function(){return (function (cdr){return cdr.reduce(function(a, b) {return a + b}, 0);});}"
}
@nathanathan
nathanathan / languageNode.json
Created November 8, 2012 05:19
paint a picture
{
"category": "example widgets",
"components": [
"paint a picture"
],
"url": "http://ngokevin.github.com/gogh/"
}
@nathanathan
nathanathan / languageNode.json
Created November 11, 2012 06:08
s_exp empty list
{
"category": "s_exp",
"components": [
{"regex": "\\(\\s*\\)"}
],
"implementation": "function () {return [];}",
"asyncImpl": "callback([])"
}
$.getJSON("http://query.yahooapis.com/v1/public/yql/", {
"env":"http://github.com/spier/yql_worldbank/raw/master/alltables.env",
"q":'SELECT * FROM worldbank.data(0,100) WHERE indicator_id = "SP.POP.TOTL" AND country_id = "GHA" AND from_year = 1980 AND to_year = 1985',
"format": "json",
"jsonp" : "?"
}, function(res) {
console.log(res.query.results.data);
});
@nathanathan
nathanathan / languageNode.json
Created November 21, 2012 06:26
populationPlot
{
"category": "main",
"components": [
"population of ", {"regex":"[\\w\\s]{2,20}", "tag" : "country"}, " since ", {"regex":"\\d{4}", "tag" : "from_year"}
],
"url": "http://nathanathan.github.com/LanguageWidgets/plotWidget.html"
}
@nathanathan
nathanathan / index.html
Last active October 13, 2015 05:27
show source
<!doctype html>
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js ie7 oldie" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js ie8 oldie" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Widget</title>
<base target="_blank" />
/* Requires underscore.js */
var SERVER_URL = "http://ec2-50-16-84-43.compute-1.amazonaws.com/xlsform/2/json_workbook/";
/*
//The ideal approach would be to send the workbook as an xlsx blob
//and process it the same way as user uploads.
//Unfortunately I can't figure out how to generate such a blob.
function sendBlob() {
var file = DocsList.getFileById(SpreadsheetApp.getActiveSpreadsheet().getId());
@nathanathan
nathanathan / languageNode.json
Created December 19, 2012 04:51
google langNode
{
"category": "main",
"components": [
"google", {"regex":"\\s*"}, {"regex":".*"}
]
}
@nathanathan
nathanathan / languageNode.json
Created December 19, 2012 05:59
recent queries language node
{
"category": "main",
"components": [
"recent queries"
]
}
@nathanathan
nathanathan / index.html
Last active December 11, 2015 17:48
Ajax request example
<!DOCTYPE html>
<meta charset="utf-8">
<style>
body {
font: 10px sans-serif;
}
</style>
<body>