Skip to content

Instantly share code, notes, and snippets.

View scripting's full-sized avatar

Dave Winer scripting

View GitHub Profile
@scripting
scripting / chatlog1.json
Last active September 27, 2016 18:29
The chatlog.json file for last night's "second-screen" experiment at screen2.io.
{
"idNextPost": 318,
"messages": [
{
"text": "<p>Please reload the page now if you have it loaded. Thanks! <img title='blush' alt='blush' class='emoji' src='http://fargo.io/code/emojify/images/emoji/blush.png' align='absmiddle' /></p>",
"authorname": "Dave Winer",
"screenname": "davewiner",
"urlIcon": "http://pbs.twimg.com/profile_images/716686126254321664/v3citfg4_normal.jpg",
"when": "2016-09-26T22:20:41.657Z",
"id": 0
@scripting
scripting / gist:a60b16e36edf01de43b8d8e74aa4d87e
Created September 28, 2016 13:49
A config.json file for nodeStorage that stores the files on an external hard disk called Broadway in s folder named 1999
{
"myPort": 1999,
"websocketPort": 2000,
"myDomain": "1999.bigbloat.io:1999",
"where": {
"flUseLocalFilesystem": true,
"publicPath": "/Volumes/Broadway/1999/",
"privatePath": "privateFiles/"
},
"twitterConsumerKey": "anm3unkb1mof7isav0bkxigby",
@scripting
scripting / slickhelloworld.html
Last active January 1, 2017 22:46
A simple Hello World app for the slick.js package
<html>
<head>
<title>Hello World for Slick</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- A simple hello world app for https://github.com/kenwheeler/slick -->
<script src="http://fargo.io/code/jquery-1.9.1.min.js"></script>
<link href="http://fargo.io/code/ubuntuFont.css" rel="stylesheet" type="text/css">
@scripting
scripting / example.js
Last active March 17, 2017 20:53
Create a new window with an icon in Electron on Linux
app.on ("ready", function () {
var nativeIcon = NativeImage.createFromPath (__dirname + "/" + "pork.png");
mainWindow = new BrowserWindow ({
width: 1100,
height: 1000,
icon: nativeIcon
});
mainWindow.loadURL('file://' + __dirname + '/index.html');
});
@scripting
scripting / example2.js
Created March 17, 2017 21:02
Simpler version of Electron code to create a new window with an icon.
app.on ("ready", function () {
mainWindow = new BrowserWindow ({
width: 1100,
height: 1000,
icon: __dirname + "/" + "pork.png"
});
mainWindow.loadURL('file://' + __dirname + '/index.html');
});
@scripting
scripting / dummyPodcastFeed.xml
Last active April 18, 2017 03:23
I use this feed for testing apps that have to process enclosures. Have your app subscribe to the feed. Just change the value of the long number to generate a new item.
<?xml version="1.0"?>
<!-- RSS generated by OPML Editor v0.75 on 4/17/17; 11:19:01 PM -->
<rss version="2.0">
<channel>
<title>Test podcast feed</title>
<link>http://scripting.com/</link>
<description>This feed contains one item that has an enclosure. I have a script that rebuilds the feed with a fresh url on the enclosure making it useful for testing podcatcher apps.</description>
<language>en-US</language>
<lastBuildDate>Tue, 18 Apr 2017 03:19:01 GMT</lastBuildDate>
<docs>http://cyber.law.harvard.edu/rss/rss.html</docs>
@scripting
scripting / buildRiverCallbackExample.js
Last active April 23, 2017 21:44
An example of a River5 callback script that's called whenever a river is built
//two globals are set up by River5 for buildRiver callbacks, fname and jsontext.
//this example creates a copy of the river in a folder on another disk, named Montreal.
var f = "/Volumes/Montreal/tmp/rivers/" + fname;
fsSureFilePath (f, function () {
fs.writeFile (f, jsontext);
});
@scripting
scripting / river5socketdemo.html
Last active December 4, 2017 01:57
This is a simple WebSockets application that hooks up to my River5 server, which is constantly scanning for new items in the feeds it follows. When a new story comes in, a JSON representation of the story goes out instantaneously over the socket.
<html>
<head>
<title>River5 websockets demo</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- app is live here: http://rss2.io/code/socketdemo/ -->
<script src="http://fargo.io/code/jquery-1.9.1.min.js"></script>
<link href="http://fargo.io/code/bootstrap.css" rel="stylesheet">
@scripting
scripting / xmlToJson.js
Last active June 8, 2017 21:09
An 8-line Node.js script to convert the XML version of Scripting News's feed to JSON.
const xml2js = require ("xml2js"), request = require ("request");
request ("http://scripting.com/rss.xml", function (error, response, data) {
if (!error && (response.statusCode == 200)) {
xml2js.parseString (data, function (err, result) {
console.log (JSON.stringify (result, undefined, 4));
});
}
});
@scripting
scripting / radioLinkblog.json
Created May 23, 2017 00:59
Since JSON feeds are in the air, it got me thinking. Radio3, my latest linkblogging tool, stores the data that's turned into RSS as (drum roll please) JavaScript structs. I added a little debugging code to list those structs in JSON. It's in two parts, the header elements and the history array. I had never looked at this before. It's kind of int…
{
"title": "Dave Winer",
"link": "http://scripting.com/",
"description": "I started up blogging, podcasting, RSS 2.0, and software for all of that. I love outliners, JavaScript. I love to make new media. Read my blog! :-)",
"language": "en-us",
"generator": "Radio3 v0.76d",
"docs": "http://cyber.law.harvard.edu/rss/rss.html",
"twitterScreenName": "davewiner",
"maxFeedItems": 25,
"appDomain": "radio3.io",