Skip to content

Instantly share code, notes, and snippets.

View scripting's full-sized avatar

Dave Winer scripting

View GitHub Profile
@scripting
scripting / slogans.js
Last active June 18, 2024 05:12
This function is included in every bit of software I write. Never know when you might need a random snarky slogan.
function getRandomSnarkySlogan (flReturnArray) { //8/15/14 by DW
const snarkySlogans = [
"Good for the environment.",
"All baking done on premises.",
"Still diggin!",
"It's even worse than it appears.",
"You should never argue with a crazy man.",
"Welcome back my friends to the show that never ends.",
"Greetings, citizen of Planet Earth. We are your overlords. :-)",
"We don't need no stinkin rock stars.",
@scripting
scripting / package.json
Last active May 24, 2024 14:16
Upload a PNG file to a WordPress repo
{
"name": "wpupload",
"description": "Develop and test code to upload images to wordpress.com.",
"version": "0.4.0",
"main": "wpupload.js",
"dependencies" : {
"daveutils": "*",
"wpcom": "*"
}
}
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": {