Skip to content

Instantly share code, notes, and snippets.

View scripting's full-sized avatar

Dave Winer scripting

View GitHub Profile
function getBlogrollOptions (headLevelAtts) {
/*
4/15/24; 8:58:41 AM by DW
The author of the blog can enable a blogroll via three head-level attributes.
We're looking for these --
blogrollUsername -- required
blogrollServer -- optional
blogrollCategory -- optional
Defaults
const appConsts = {
title: "Chuck's Blogroll",
idWhereToAppend: "idBlogrollContainer",
urlFeedlandServer: "https://feedland.social/",
urlSocketServer: "wss://feedland.social/",
urlBlogrollOpml: "https://feedland.com/opml?screenname=cagrimmett&catname=blogroll",
urlFeedlandViewBlogroll: "https://feedland.com/?username=cagrimmett&catname=blogroll",
maxItemsInBlogroll: 40,
flShowSocketMessages: true,
flBlogrollUpdates: true,
{
"title": "People and Blogs",
"script": "console.log('Made with FeedLand - https://feedland.com'); var ribbon = document.createElement('div'); ribbon.classList.add('ribbon'); ribbon.innerHTML = '<a href=\"https://feedland.com\" target=\"_blank\">Made with FeedLand</a></div>'; document.getElementsByClassName('divPageBody')[0].appendChild(ribbon);",
"style": <code>
body { font-family: 'Sentient', 'Georgia',serif; background-color: #fffcf2; }
.ribbon { background-color: #f2a93c; overflow: hidden; white-space: nowrap; position: absolute; left: -50px; top: 40px; transform: rotate(-45deg); box-shadow: 0 0 10px #999;}
.ribbon a { color: #fff; display: block; font: bold 81.25% 'Helvetica Neue', Helvetica, Arial, sans-serif; margin: 1px 0; padding: 8px 50px; text-align: center; text-decoration: none; }
.divNewsProduct .divProductTitle { font-family: unset; letter-spacing: unset; }
.divTabsContainer .divTabs li { font-family: unset; }
.divPageBody
@scripting
scripting / test.json
Last active January 23, 2024 15:33
I am testing to see if the URL of a Gist changes when you edit it
{
"githubServeFrom": {
"username": "scripting",
"repository": "SomePrivateRepoasdfasdfxxxx",
"path": "docs",
"accessToken": "hellofromsanjose"
},
"indexFilename": "README",
"urlDefaultMarkdownTemplate": "https://s3.amazonaws.com/scripting.com/code/feedland/docswebsite/markdowntemplate.txt",
on saveReadingList (screenname, catname, fname) {
local (url = "https://feedland.com/opml?screenname=" + screenname + "&catname=" + catname);
local (opmltext = tcp.httpreadurl (url));
file.writewholefile (githubfolder + "lists:" + fname, opmltext)
};
saveReadingList ("davewiner", "podcasts", "davepodcasts.opml")
@scripting
scripting / bingeworthy.sql
Created December 1, 2023 15:12
SQL code to create Bingeworthy database
create table programs (
id varchar (255),
type varchar (32),
title varchar (255),
screenname varchar (255),
approved boolean,
whencreated datetime,
whenmodified datetime,
primary key (id)
);
const urlRiver = "https://feedland.org/getriverfromreadinglist?url=https://lists.feedcorps.org/artshow.opml";
function httpRequest (url, timeout, headers, callback) {
timeout = (timeout === undefined) ? 30000 : timeout;
var jxhr = $.ajax ({
url: url,
dataType: "text",
headers,
timeout
})
@scripting
scripting / config.json
Created October 2, 2023 14:56
An example of a PagePark config.json file to access a private repo via the web
{
"githubServeFrom": {
"username": "scripting",
"repository": "SomePrivateRepo",
"path": "docs",
"accessToken": "hellofromsanjose"
},
"indexFilename": "README",
"urlDefaultMarkdownTemplate": "https://s3.amazonaws.com/scripting.com/code/feedland/docswebsite/markdowntemplate.txt",
"pageParams": {
@scripting
scripting / testUserDatafile.js
Last active September 24, 2023 22:04
The test FeedLand runs to be sure static memory is working by calling the server to set and get a JSON file
function testUserDatafiles (ctsecs=0) { //9/19/23 by DW
function oneTest (callback) {
const fname = "test.json", whenstart = new Date ();
var theTestData = {
theArray: new Array ()
}
for (var i = 1; i <= 15; i++) {
theTestData.theArray.push (getRandomSnarkySlogan ());
}
uploadUserDataFile (fname, jsonStringify (theTestData), "application/json", true, function (err, data) {
function testUserDatafiles (ctsecs=0) { //9/19/23 by DW
const fname = "test.json", whenstart = new Date ();
var theTestData = {
theArray: new Array ()
}
for (var i = 1; i <= 15; i++) {
theTestData.theArray.push (getRandomSnarkySlogan ());
}
console.log ("testUserDatafiles");
console.log ("theTestData == " + jsonStringify (theTestData));