Skip to content

Instantly share code, notes, and snippets.

View scripting's full-sized avatar

Dave Winer scripting

View GitHub Profile
@scripting
scripting / sendToSlack.js
Last active July 9, 2022 13:03
A tiny JavaScript app that sends a message to your default Slack channel. Can be customized with a name, icon, emoji or sent to a different channel. Runs in Node.js.
var request = require ("request");
var urlWebHook = "https://hooks.slack.com/services/abcdef"; //the URL you get on your "incoming web hooks" page.
function sendToSlack (s, theUsername, theIconUrl, theIconEmoji, theChannel) {
var payload = {
text: s
};
if (theUsername !== undefined) {
payload.username = theUsername;
@scripting
scripting / testRssCloud.js
Last active August 9, 2016 18:14
A simple app that tests Andrew's implementation of an rssCloud server.
var myVersion = "0.40", myProductName = "testRssCloud", myPort = 2222, myDomain = "yourserver.io";
//Test app for Andrew Shell's rssCloud server
//https://github.com/andrewshell/rsscloud-server
var request = require ("request");
var http = require ("http");
var urlpack = require ("url");
var dns = require ("dns");
var qs = require ("querystring");
@scripting
scripting / exampleRiver4Callback.js
Last active August 29, 2015 14:23
An example of a callback script that runs when a new item is added to the river.
var now = new Date ();
if (localStorage.feeds === undefined) {
localStorage.feeds = new Object ();
}
if (localStorage.feeds [urlfeed] === undefined) {
localStorage.feeds [urlfeed] = {
ctAdds: 0,
whenFirstAdd: now
};
}
@scripting
scripting / localStorageSnapshot.json
Created June 21, 2015 05:21
A snapshot of the localStorage.json file after running the demo callback script inside River4 for a few hours.
{
"feeds": {
"http://www.nytimes.com/services/xml/rss/nyt/Travel.xml": {
"ctAdds": 1,
"whenFirstAdd": "2015-06-21T03:02:55.237Z",
"whenLastAdd": "2015-06-21T03:02:55.237Z",
"stories": [
"Frugal Traveler: Exploring Franche-Comté, France’s Well-Kept Secret"
]
},
@scripting
scripting / getjsonopml.js
Created June 27, 2015 14:13
A PagePark page implemented in JavaScript that returns the JSON representation of an OPML outline. See the notes for v0.63 for more info.
opmlLib.readOpmlUrl (parsedUrl.query.url, function (theOutline) {
httpResponse.writeHead (200, {"Content-Type": "application/json", "Access-Control-Allow-Origin": "*"});
httpResponse.end (utils.jsonStringify (theOutline));
});
@scripting
scripting / getdavewineropml.js
Created June 29, 2015 12:04
A PagePark page implemented in JavaScript that returns the JSON representation of an OPML outline. See the notes for v0.63 for more info.
var urlOpml = "http://davewiner.com/davewiner.opml";
opmlLib.readOpmlUrl (urlOpml, function (theOutline) {
httpResponse.writeHead (200, {"Content-Type": "application/json", "Access-Control-Allow-Origin": "*"});
httpResponse.end (utils.jsonStringify (theOutline));
});
@scripting
scripting / config.json
Last active August 29, 2015 14:25
The config.json file that makes discuss.userland.com URLs work once again.
{
"jsSiteRedirect":
"'http://static.userland.com/userLandDiscussArchive/msg' +
utils.padWithZeros (parsedUrl.pathname.split ('$') [1], 6) + '.html'"
}
@scripting
scripting / mediumTestBed.html
Created July 20, 2015 21:20
A place for me to test Medium-Editor, for possible inclusion in MyWord Editor. There's a link to a running version of the app in the comment thread, below.
<html>
<head>
<title>medium-editor test</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="http://fargo.io/code/jquery-1.9.1.min.js"></script>
<link href="http://fargo.io/code/bootstrap.css" rel="stylesheet">
<script src="http://fargo.io/code/bootstrap.min.js"></script>
@scripting
scripting / helloWorldMediumEditor.html
Last active August 29, 2015 14:25
A simple Hello World app for medium-editor, https://github.com/yabwe/medium-editor
<html>
<head>
<title>Hello World for medium-editor</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="http://fargo.io/code/jquery-1.9.1.min.js"></script>
<link href="http://fargo.io/code/bootstrap.css" rel="stylesheet">
<script src="http://fargo.io/code/bootstrap.min.js"></script>
@scripting
scripting / config.json
Last active August 29, 2015 14:26
A config.json for nodeStorage that specifies that files are stored in the local filesystem, not S3.
{
"enabled": true,
"myPort": 1229,
"myDomain": "storage.bloatware.org:1229",
"where": {
"flUseLocalFilesystem": true,
"publicPath": "mypublicfiles/",
"privatePath": "myprivatefiles/"
},
"basePublicUrl": "http://storage.bloatware.org:1229",