Skip to content

Instantly share code, notes, and snippets.

View blaine's full-sized avatar

Blaine Cook blaine

View GitHub Profile
var setTextMeasure = function (contentElement, targetMeasure, maxSize, minSize) {
if (!contentElement) contentElement = document.createElement('p');
if (!targetMeasure) targetMeasure = 66;
if (!maxSize) maxSize = 16;
if (!minSize) minSize = 9;
var sizer = contentElement.cloneNode();
sizer.style.cssText = 'margin: 0; padding: 0; color: transparent; background-color: transparent; position: absolute;';
The Problem with Delegated Sign-in
Scenario:
The owner of tastybeer.com wants to use delegated sign-in, and not store users' passwords. They've seen the light and don't want a NASCAR array of sign-in buttons, and require the users' email addresses, so the sign-in form is simply:
[ fill in email ] [[ Sign In ]]
When a user, say example@gmail.com, arrives at tastybeer.com, he enters his email address and begins to sign in:
@blaine
blaine / contenteditable bug.html
Created January 30, 2013 12:32
This is an obscure and totally weird bug to do with contenteditable rendering when a negative text-indent is applied. Basically, the insertion point only appears when the contenteditable element has content. When it's empty, the insertion point is empty.
<html>
<head>
<style>
.container {
width: 50px;
height: 1em;
position: absolute;
left: 500px;
top: 200px;
background: yellow;

Keybase proof

I hereby claim:

  • I am blaine on github.
  • I am blaine (https://keybase.io/blaine) on keybase.
  • I have a public key whose fingerprint is 8CE8 E208 4D6F 83A6 1A92 EB0D 3D02 F471 0516 1BE4

To claim this, I am signing this object:

Verifying that "blaine.id" is my Blockstack ID. https://onename.com/blaine