I hereby claim:
- I am jedschmidt on github.
- I am jedschmidt (https://keybase.io/jedschmidt) on keybase.
- I have a public key whose fingerprint is F1D6 924F 3B26 FB87 B488 2664 ED0D 4AE7 933C 4D2A
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
var crypto = require("crypto") | |
module.exports = function() { | |
var bytes = crypto.randomBytes(16) | |
bytes[6] &= 0x0f // 0000xxxx | |
bytes[6] += 0x40 // 0100xxxx | |
bytes[8] &= 0x3f // 00xxxxxx | |
bytes[8] += 0x80 // 10xxxxxx |
Use this bookmarklet to escape the URL of the current page and evade Twitter's broken malware link flagging. It prepends all periods with a zero-width space, which Chrome, Firefox, and Safari all seem to ignore. Twitter's server won't recognize it as a link (yet), but the Twitter client will, which means it remains clickable in the DM pane.
For example: https://twitter.com/ will get flagged as malware in a DM, while https://twitter.com/ won't. They look the same, but the latter has a ZWSP before the .
in .com
.
One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.
Most workflows make the following compromises:
Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure
flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.
Use production SSL certificates locally. This is annoying
var then = Date.now() | |
function monotonicTimestamp(cb) { | |
var now = Date.now() | |
now > then | |
? setImmediate(cb, null, then = now) | |
: setTimeout(cb, then - now, null, ++then) | |
} |
_ ___ _ ___ _ _ ___ _ _ ___ _ ___ ___ _ _ | |
| | | __| /_\ | _ \ \| | | __| \| |/ __| | |_ _/ __| || | | |
| |__| _| / _ \| / .` | | _|| .` | (_ | |__ | |\__ \ __ | | |
|____|___/_/ \_\_|_\_|\_| |___|_|\_|\___|____|___|___/_||_| |
var levelup = require("levelup") | |
var path = __dirname + "db" | |
var options = {encoding: "json"} | |
var db = levelup(path, options) | |
function id(cb) { | |
if (typeof cb != "function") throw new TypeError | |
if (!id.queue) { | |
id.queue = [] |
$ npm -g install local-tld | |
npm http GET https://registry.npmjs.org/local-tld | |
npm http 304 https://registry.npmjs.org/local-tld | |
> [email protected] preuninstall /usr/local/lib/node_modules/local-tld | |
> ./bin/local-tld-uninstall | |
++ id -u | |
+ '[' 501 -eq 0 ']' | |
+ SUDO=sudo |
(tl;dr DOM builders like [domo][domo] trump HTML templates on the client.)
Like all web developers, I've used a lot of template engines. Like most, I've also written a few of them, some of which even [fit in a tweet][140].
The first open-source code I ever wrote was also one of the the first template engines for node.js, [a port][node-tmpl] of the mother of all JavaScript template engines, [John Resig][jresig]'s [micro-templates][tmpl]. Of course, these days you can't swing a dead cat without hitting a template engine; one in eight packages on npm ([2,220][npm templates] of 16,226 as of 10/19) involve templates.
John's implementation has since evolved and [lives on in Underscore.js][underscore], which means it's the default choice for templating in Backbone.js. And for a while, it's all I would ever use when building a client-side app.
But I can't really see the value in client-side HTML templates anymore.