Skip to content

Instantly share code, notes, and snippets.

View scripting's full-sized avatar

Dave Winer scripting

View GitHub Profile
@scripting
scripting / example.json
Last active May 31, 2025 22:29
Example that sets the legalTags to the tags and attributes that WordLand supports.
"legalTags": {
"allowedTags": [
"p", "br", "b", "i", "strong", "em", "h3", "blockquote", "ul", "ol", "li"
],
"allowedAttributes": {
}
}
@scripting
scripting / daytona.md
Last active May 20, 2025 17:16
Daytona query for "matt mullenweg" in double-quotes.
select *, 
	match (textForSearch) against ('\"matt mullenweg\"') as relevance 
from blogposts 
where match (textForSearch) against ('\"matt mullenweg\"') 
order by relevance desc, whenCreated desc 
limit 100;
@scripting
scripting / rerouteImages.js
Last active May 19, 2025 20:33
I was going to use this in my search engine, when it wanted to display an image over http, reroute it to use an https proxy server. But Chrome wouldn't stay out of the way, so had to give up. Hey I was trying to route around their outage.
function reRouteImgs () { //5/19/25 by DW
$(window).on ("load", function () {
console.log ("reRouteImgs");
$("body img").each (function () {
const url = $(this).attr ("src");
if (beginsWith (url, "http://")) {
console.log ("reRouteImgs: url == " + url);
const proxiedUrl = "https://someproxy.com/?url=" + encodeURIComponent (url) + "&nocache=" + Date.now ();
$(this).attr ("src", "");
$(this).attr ("src", proxiedUrl);
@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": "*"
}
}