Skip to content

Instantly share code, notes, and snippets.

@jtacoma
jtacoma / introspect.cpp
Created August 1, 2021 17:38
A way to implement introspection for C++ types allowing easier decoupling from data format and serialization libraries
// Copyright 2021 Google LLC
// SPDX-License-Identifier: Apache-2.0
#include <cstddef> // ptrdiff_t
#include <string>
#include <tuple>
#include <utility>
namespace introspect {

Keybase proof

I hereby claim:

  • I am jtacoma on github.
  • I am jtacoma (https://keybase.io/jtacoma) on keybase.
  • I have a public key ASC328gnRGwyuwCVfmYaO19xO7hgmtm_OLHZqTm9ip_x8Qo

To claim this, I am signing this object:

@jtacoma
jtacoma / main_test.go
Last active August 17, 2019 17:38
Some difficulty with BadgerDB
package main
import (
"fmt"
"io"
"io/ioutil"
"log"
"os"
"testing"
@jtacoma
jtacoma / openpgp.txt
Created September 4, 2017 17:06
OpenKeychain Linked Identity
This Gist confirms the Linked Identity in my OpenPGP key, and links it to this GitHub account.
Token for proof:
[Verifying my OpenPGP key: openpgp4fpr:079a07c864f3d51cde5830a00e0f131e6ff70348]
@jtacoma
jtacoma / openpgp.txt
Created September 4, 2017 17:06
OpenKeychain Linked Identity
This Gist confirms the Linked Identity in my OpenPGP key, and links it to this GitHub account.
Token for proof:
[Verifying my OpenPGP key: openpgp4fpr:079a07c864f3d51cde5830a00e0f131e6ff70348]
@jtacoma
jtacoma / openpgp.txt
Created September 4, 2017 17:05
OpenKeychain Linked Identity
This Gist confirms the Linked Identity in my OpenPGP key, and links it to this GitHub account.
Token for proof:
[Verifying my OpenPGP key: openpgp4fpr:079a07c864f3d51cde5830a00e0f131e6ff70348]
@jtacoma
jtacoma / openpgp.txt
Created September 4, 2017 17:05
OpenKeychain Linked Identity
This Gist confirms the Linked Identity in my OpenPGP key, and links it to this GitHub account.
Token for proof:
[Verifying my OpenPGP key: openpgp4fpr:079a07c864f3d51cde5830a00e0f131e6ff70348]
@jtacoma
jtacoma / README.md
Last active August 29, 2015 14:13
pushenv

pushenv

pushenv helps update your Bash or Zsh environment for compilation and linking with dependencies that are built and installed to different paths.

Installation

source pushenv.sh

@jtacoma
jtacoma / index.md
Created October 23, 2014 16:39
Dialogues don't have menu bars

A dialogue box doesn't have menu bars, tool bars, tool strips, ribbons, or status bars. A dialogue box has one or more buttons near the bottom. Clicking on a button that is labelled Ok, Cancel, Yes, or No normally closes the dialogue but this can sometimes be circumvented e.g. by an error about missing or malformed data, or by saying No in response to a subsequent dialogue that asks, "Are you sure?" Some authorities distinguish dialogue boxes from message boxes by the latter's inability to receive any user input beyond which button was pressed, but they are otherwise the same.

  • A dialogue box cannot be maximized or minimized.
  • Closing a dialogue box has the same effect as clicking its Cancel button if the dialogue box has a Cancel button, otherwise the No button. If a dialogue box has no such button, it should not be possible to close the dialogue box without clicking a button.
  • When the keyboard focus is on a dialogue box that has a Cancel button, pressing the Esc key is equivale
@jtacoma
jtacoma / index.md
Last active August 29, 2015 14:08
UTF is not a character encoding

[Unicode transformation formats (UTF)][utf] is not a character encoding. It is a family of mutually incompatible character encodings that are each capable of expressing the full range of possible Unicode characters.

Microsoft desktop applications that deal with plain text files, e.g. Notepad and Excel, use [UTF-16LE][utf16] under the name Unicode. Newer versions also offer UTF-16BE under the name Unicode big endian. An idiosyncrasy of Microsoft applications is that the character encoding of a plain text file is declared in a [byte order mark (BOM)][bom] at the beginning of the file. This works like magic in many cases, but results in a few garbled characters at the beginning of the file when the BOM is not respected as such.

While the preferred encoding for web applications these days is [UTF-8][utf8], not all platforms allow custom content to declare its character encoding. Even Microsoft's own IIS doesn't respect the [BOM][bom]. Plain text file formats like CSS and JavaScript that, unlike XML an