Peter Naur's classic 1985 essay "Programming as Theory Building" argues that a program is not its source code. A program is a shared mental construct (he uses the word theory) that lives in the minds of the people who work on it. If you lose the people, you lose the program. The code is merely a written representation of the program, and it's lossy, so you can't reconstruct
type LinkifiedString = Array<string | JSX.Element> | string | null | undefined | |
/** | |
* Turn a string into JSX with autolinks | |
*/ | |
export function getLinkifiedString(str: string | null | undefined): LinkifiedString { | |
try { | |
// Group by whitespace (wrapping regex in parens keeps matched results in the array) | |
const substrings = str?.split(/(\s+)/g) |
import * as React from 'react' | |
import { SpringValue, easings, useSpring } from 'react-spring' | |
/** | |
* Hook that animates height when args.animationKey changes | |
* | |
* Ex: | |
* const animatedBlock = useAnimatedHeight({ | |
* animationKey: key, | |
* }) |
- Create a file
Image.js
from the source below (it is almost a copy of Image.js from tiptap-extensions except that it has a constructor that acceptsuploadFunc
(function to be called withimage
being uploaded) and additional logicif(upload) { ... } else { ... previous base64 logic .. }
in thenew Plugin
section.
import {Node, Plugin} from 'tiptap'
import {nodeInputRule} from 'tiptap-commands'
/**
* Matches following attributes in Markdown-typed image: [, alt, src, title]
*
struct ViewControllerHolder { | |
weak var value: UIViewController? | |
init(_ value: UIViewController?) { | |
self.value = value | |
} | |
} | |
struct ViewControllerKey: EnvironmentKey { | |
static var defaultValue: ViewControllerHolder { return ViewControllerHolder(UIApplication.shared.windows.first?.rootViewController ) } |
import Combine | |
import CoreFoundation | |
import CoreGraphics | |
import CoreText | |
import Darwin | |
import Foundation | |
import SwiftUI | |
import UIKit | |
import os.log | |
import os |
ffmpeg -framerate 30 -pattern_type glob -i '*.jpeg' -c:v libx264 -pix_fmt yuv420p output.mp4 |
// control the session data on your connection | |
experimental.datPeers.getSessionData() | |
experimental.datPeers.setSessionData(obj) // obj must be no larger than 255 bytes when JSONified | |
// manage connected peers | |
var peers = experimental.datPeers.list() // list all peers connected to the current page's dat | |
var peer = experimental.datPeers.get(peerId) | |
await experimental.datPeers.broadcast(data) // send a message to all peers | |
experimental.datPeers.addEventListener('connect') // new peer | |
experimental.datPeers.addEventListener('disconnect') // peer closed connection |
There's a somewhat old-fashioned term in computing (old-fashioned being a relative concept) and the term is "live."
Back when Xerox PARC was making the first real GUI and building the first Object-Oriented programming language (Smalltalk) they were building a live environment. And "live" meant that the code was right there, available to the user, ready to edit. If you go back and look at the demos of Smalltalk, you see people jumping into that code and modding the environment on-the-fly, and that's what live meant! It meant you could mess with the code.
There's a complementary term, just as old-fashioned but much more relevant, and that's "dead." That's what cloud computing is: dead computing. It's compiled, packaged, shipped, and completely unchangeable -- a total black box to the user.
Live is vibrant. Live is community-owned. Live means that mods and plugins are going to emerge out of the userbase. Some of the most popular and well-known computer games
This Gist is a quick writeup for devs using the beta or master
build. We'll get a more complete writeup in the Beaker site docs on 0.8's final release. Feel free to open issues for discussion.
We've done some work on the DatArchive
API to make it easier to use. Prior to 0.8, Dats had a "staging area" folder which you had to commit()
to publish. In 0.8, Beaker will automatically sync that folder. As a result, the staging-area methods (diff()
commit()
and revert()
) were deprecated. There are also some new methods, and a few changes to how events work.
Here's a full reference: