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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- vim: tabstop=2 shiftwidth=2 expandtab | |
-- We almost always start by importing the wezterm module | |
local wezterm = require 'wezterm' | |
-- Define a lua table to hold _our_ module's functions | |
local module = {} | |
-- Returns a bool based on whether the host operating system's | |
-- appearance is light or dark. | |
function module.is_dark() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:async'; | |
import 'dart:convert'; | |
import 'dart:io'; | |
import 'package:vm_service/vm_service_io.dart'; | |
void main() async { | |
var process = await Process.start('dart', ['run', '--enable-vm-service', 'lib/main.dart']); | |
var completer = Completer<String>(); | |
process.stdout | |
.transform(utf8.decoder) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This code is licensed under the terms of the MIT license https://opensource.org/license/mit | |
# Copyright (c) 2021 Marat Reymers | |
## Golden config for golangci-lint v1.62.0 | |
# | |
# This is the best config for golangci-lint based on my experience and opinion. | |
# It is very strict, but not extremely strict. | |
# Feel free to adapt and change it for your needs. | |
run: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1" /> | |
<title>*scratch*</title> | |
<style> | |
body { | |
font-family: Hack, Menlo, Monaco, 'Droid Sans Mono', 'Courier New', monospace; | |
white-space: pre; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Export all data from an IndexedDB database | |
* | |
* @param {IDBDatabase} idbDatabase The database to export from | |
* @return {Promise<string>} | |
*/ | |
export function exportToJson(idbDatabase) { | |
return new Promise((resolve, reject) => { | |
const exportObject = {} | |
if (idbDatabase.objectStoreNames.length === 0) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns typehint.core) | |
;; A little type hint hint... | |
(set! *warn-on-reflection* true) | |
;; There are two ways to type hint the return value of a function, but one is | |
;; (technically) wrong: | |
(defn ^String as-string0 |
A list of commonly asked questions, design decisions, reasons why Clojure is the way it is as they were answered directly by Rich (even when from many years ago, those answers are pretty much valid today!). Feel free to point friends and colleagues here next time they ask (again). Answers are pasted verbatim (I've made small adjustments for readibility, but never changed a sentence) from mailing lists, articles, chats.
How to use:
- The link in the table of content jumps at the copy of the answer on this page.
- The link on the answer itself points back at the original post.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require '[datomic.api :as d]) | |
(defn entity-changes | |
"Return transaction history for an entity and its components. | |
Returns a sequence of maps, each is the transaction map (tx metadata) plus a | |
key `:entity-changes`, which is a nested map of keys: entity id, attribute | |
ident, `:db/add` or `:db/retract`, and the value added or retracted, e.g.: | |
{12345678910 {:long-card-1-attr {:db/retract 1 | |
:db/add 0} | |
:long-card-many-attr {:db/add #{0}} |
NewerOlder