Skip to content

Instantly share code, notes, and snippets.

View blaine's full-sized avatar

Blaine Cook blaine

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

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:

@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;
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:
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;';
/*
smtpd.js is SMTP server written for node.js
MIT License
*/
var tcp = require('tcp');
var sys = require('sys');
var sys = require('sys'),
http = require('http'),
url = require('url');
var subscriptions = {}
function getSubscribers (did) {
if (subscriptions[did]) {
// log open already.
return subscriptions[did];
// in some global context. this is just a sketch, not intended to be deployed.
function watchModuleUrl(url, parent) {
var resolvedModule = resolveModulePath(request, parent);
var id = resolvedModule[0],
paths = resolvedModule[1];
findModulePath(url, paths, function (filename) {
if (!filename) return;
app
|
+--- latest -> checkout-2
|
+--- checkout-1
| |
| +--- requestHandler.js
| \--- lib
| |
| +--- myLib.js
-- tables in extreme pseudocode
-- saved_searches:
int search_id primary key
string search
-- saved_searches_helper:
int search_id foreign key saved_searches(search_id)
int term_id foreign key terms(term_id)
int term_count