Skip to content

Instantly share code, notes, and snippets.

@tbveralrud
tbveralrud / submodule-update-fix-snippet.yml
Created January 21, 2016 00:20
(Temporary) Fix for submodule update error on CircleCI
# CircleCI failed to build a git submodule update step.
# Tracked it down to partially complete .git/modules existing in our source cache.
# This removes the .git/modules directory before the submodule update.
# The error:
# $ git submodule update --init
# git submodule update --init returned exit code 128
# fatal: Not a git repository: ../.git/modules/<project> Action failed: git submodule update --init
checkout:
@tbveralrud
tbveralrud / CustomLuaBinding.swift
Created January 25, 2018 16:14
lua4swift: General type checker for custom Lua Userdata types
import Lua
protocol CustomLuaBinding: CustomTypeInstance {
/// This is a 'type checker' function.
/// It is used to validate expected types when binding a method to a Lua-wrapped type.
///
/// e.g.
/// ```
/// type.createMethod([Foo.arg, Bar.arg, Baz.arg], _ fn: ....)
@tbveralrud
tbveralrud / escapeImplicitAutofillValue.ts
Last active March 27, 2019 20:22
How to escape implicit autofill values in HTML label elements
// Browsers don't respect `autocomplete='off'`.
// Safari (maybe others) will inspect the text value of a `label` element to predict intent.
// Sometimes we want to include 'name' in the value and not have it interpreted as a 'user name'.
// This function will transform the string to a visually equivalent string by inserting `zero width join` characters.
const wordJoiner = '\u{2060}';
export function escapeImplicitAutofillValue(label: string): string {
return label.split('').join(wordJoiner);
}