Skip to content

Instantly share code, notes, and snippets.

Dave Winer scripting

Block or report user

Report or block scripting

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gitCloneSnippet.js
const urlRepo = "https://github.com/scripting/test2";
const localFolderPath = "myAppFolder/";
git.clone (urlRepo, localFolderPath, function (err) {
});
View sharedObjectExample.json
{
"version": 1,
"metadata": {
"ctSaves": 41,
"whenLastSave": "9/8/2019, 10:21:01 AM",
"whenCreated": "9/8/2019, 10:19:39 AM"
},
"data": {
"mynum": 6,
"counter": 594,
View package.json
{
"name": "test",
"description": "Test app for persists package.",
"author": "Dave Winer <dave@scripting.com>",
"license": "MIT",
"version": "0.4.0",
"dependencies" : {
"persists": "*"
}
}
View package.json
{
"name": "proxypersisttest",
"description": "A little test app that uses JavaScript proxy to manage a persistent stats object.",
"author": "Dave Winer <dave@scripting.com>",
"license": "MIT",
"version": "0.4.0",
"dependencies" : {
"daveutils": "*"
}
}
@scripting
scripting / typicalXmlRpcServer.js
Created Sep 3, 2019
This is a typical XML-RPC server written in JavaScript as of today. There's still more cleanup to do, for example, you shouldn't have to specify flPostEnabled in config, since XML-RPC calls are only made via POST, it can be handled at the lower level.
View typicalXmlRpcServer.js
const xmlrpc = require ("davexmlrpc");
const utils = require ("daveutils");
const davehttp = require ("davehttp");
const mail = require ("davemail");
const fs = require ("fs");
var config = {
port: 1417,
flPostEnabled: true,
flLogToConsole: true,
View response.txt
HTTP/1.1 200 OK
content-type: text/xml
date: Sun, 01 Sep 2019 19:44:33 GMT
connection: close
transfer-encoding: chunked
1f7
<?xml version="1.0"?>
<methodResponse>
<params>
@scripting
scripting / demoriver.html
Created Jul 9, 2019
Template for your river, for testing by Anton.
View demoriver.html
<html>
<head>
<title>Demo River</title>
<link href="//fonts.googleapis.com/css?family=Ubuntu:400,500i,700" rel="stylesheet">
<link rel="stylesheet" href="//s3.amazonaws.com/scripting.com/code/fontawesome/css/all.css">
<script src="//s3.amazonaws.com/scripting.com/code/includes/jquery-1.9.1.min.js"></script>
<link href="//s3.amazonaws.com/scripting.com/code/includes/bootstrap.css" rel="stylesheet">
<script src="//s3.amazonaws.com/scripting.com/code/includes/bootstrap.min.js"></script>
<script src="//s3.amazonaws.com/scripting.com/code/includes/basic/code.js"></script>
<link href="//s3.amazonaws.com/scripting.com/code/includes/basic/styles.css" rel="stylesheet" type="text/css">
@scripting
scripting / config.json
Last active Oct 29, 2018
Example config.json file for githubpub
View config.json
{
"port": 1402,
"clients": {
"michigan": {
"id": "w7eonmdnlsnfysqjatl3",
"secret": "7i7h1iotnwzqqm4psjqtmgnvw2ga3rcki5kv52hb",
"urlEditorApp": "http://mysite.com/editor/"
}
},
"defaultNameCommitter": "Lawyer Boyer",
@scripting
scripting / yamlize.js
Last active Sep 23, 2018
Convert between YAML and JSON and vice versa
View yamlize.js
const utils = require ("daveutils");
const yaml = require ("js-yaml");
function yamlIze (jsontext) {
var jstruct = JSON.parse (jsontext);
const delimiter = "---\n";
var text = jstruct.text;
delete jstruct.text;
var s = delimiter + yaml.safeDump (jstruct) + delimiter + text;
@scripting
scripting / package.json
Last active Sep 12, 2018
Getting the contents of a GitHub repository using the contents API
View package.json
{
"name": "repocontents",
"description": "Code to get the contents of a respository.",
"author": "Dave Winer <dave@smallpicture.com>",
"version": "0.4.0",
"main": "repocontents.js",
"scripts": {
"start": "node repocontents.js"
},
"dependencies" : {
You can’t perform that action at this time.