Skip to content

Instantly share code, notes, and snippets.

View scripting's full-sized avatar

Dave Winer scripting

View GitHub Profile
@scripting
scripting / draft.json
Last active March 19, 2025 16:35
The data we store for a WordLand draft I wrote a few days ago.
{
"title": "Blogging is due for a refresh",
"content": "A lot has changed since the last time we took a serious look at blogging. \n\nA few items, as examples.\n\n1. When RSS came along Markdown didn't exist. The two technologies belong together, imho.\n2. Servers got cheap! (and easy to deploy).\n3. Websockets have replaced long polling.\n4. SQL is fast and the tools are much better.\n5. The user interfaces of all the Web 2.0+ products didn't exist last time we created new blogging communities. We can borrow ideas from twitter-like systems, even huge products like Facebook and Spotify have innovations that come long after the initial wave of blogging.\n\nBut one thing stays the same -- all the components are replaceable. Absolutely zero lock-in. We use simple standard APIs where they exist, and create new minimal formats and protocols where they don't.\n\nBlogging has a simple philosophy that remains constant.",
"categories": [
"bloggers",
"philosophy",
"products",
"tech",
"wordland",
"wo
@scripting
scripting / wordlandDraft.json
Last active March 17, 2025 21:29
WordLand: This is the data we keep for a draft message
{
"title": "Blogging is due for a refresh",
"content": "A lot has changed since the last time we took a serious look at blogging. \n\nA few items, as examples.\n\n1. When RSS came along Markdown didn't exist. The two technologies belong together, imho.\n2. Servers got cheap! (and easy to deploy).\n3. Websockets have replaced long polling.\n4. SQL is fast and the tools are much better.\n5. The user interfaces of all the Web 2.0+ products didn't exist last time we created new blogging communities. We can borrow ideas from twitter-like systems, even huge products like Facebook and Spotify have innovations that come long after the initial wave of blogging.\n\nBut one thing stays the same -- all the components are replaceable. Absolutely zero lock-in. We use simple standard APIs where they exist, and create new minimal formats and protocols where they don't.\n\nBlogging has a simple philosophy that remains constant.",
"categories": [
"bloggers",
"philosophy",
"products",
"tech",
"wordland",
"wordpress",
@scripting
scripting / parseUserAgentString.js
Created February 26, 2025 16:43
I'm interested in knowing what browsers people who use WordLand are using, so I asked ChatGPT to write some code that makes sense of them in some human-readable way. This is what it came up with. Interested in knowing what people think? I imagine there are packages that do this but I haven't looked yet.
function parseUserAgent(uaString) {
let browser = "Unknown Browser", version = "?", os = "Unknown OS";
// OS Detection
if (/Windows NT/i.test(uaString)) {
os = "Windows";
} else if (/Macintosh/i.test(uaString)) {
os = "Mac";
} else if (/Linux/i.test(uaString)) {
os = "Linux";
@scripting
scripting / properties.json
Last active January 21, 2025 22:15
Properties sent to WordLand
{
"server": "http://tv.bingeworthy.org/savecomment",
"idprogram": "https://www.metacritic.com/tv/industry/",
"screenname": "scripting",
"token": "xxx",
"app": "Bingeworthy 3",
"what": "program review",
"title": "Industry"
}
@scripting
scripting / blob.json
Created January 5, 2025 16:53
This is the message from Bluesky informing you that they broke your image-uploading code.
{
"error": "InvalidRequest",
"message": "Legacy blob ref at 'embed/images/image'"
}
@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