Skip to content

Instantly share code, notes, and snippets.

View busticated's full-sized avatar

Busticated busticated

View GitHub Profile
@jboner
jboner / latency.txt
Last active May 7, 2025 10:07
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@wwqrd
wwqrd / Jakefile.js
Created November 14, 2012 13:47
Example Jakefile.js
namespace('test', function () {
desc('Run server tests');
task('server', [], function () {
jake.exec('mocha spec', function () {
console.log('Server tests passed');
complete();
});
});
desc('Run client tests');

Example output, where | is the cursor:

function () {
  |
};
foo(function () {
@domenic
domenic / needs-a-name.js
Last active December 20, 2015 00:09
This needs a name
// Needs a clever name like "debounce" or "throttle" (but it's not either of those.)
function doOperationButOnlyReactIfItWasntCalledAgainInBetween(promiseOperation) {
var latestOperation = null;
return function () {
var deferred = Q.defer();
var operation = promiseOperation.apply(this, arguments);
latestOperation = operation;
operation.then(
@mikeal
mikeal / gist:6084298
Last active December 20, 2015 06:18
Been rather busy....

Because I've been so busy lately I haven't really had a chance to talk about anything I've built or been using, but i've been publishing so many new modules it's worth going back over.

Real quick, Getable is a mobile/desktop ordering and fullfillment application for commercial construction. Think mobile amazon/ebay for large construction jobsites.

First off, everything is realtime, using engine.io with everything but long polling turned off. We tried leaving websockets on but there were some nasty bits that made the connection die and not come back on iPhone which we just couldn't debug in time so we turned it off.

Engine.io is a great module as it just provides a simple duplex stream-like (more on this later) interface that upgrades itself when available. This meant that in order to get some use out of it I had to write a few modules.

eiojson sends JSON messages rather than strings bidirectiona

@jed
jed / how-to-set-up-stress-free-ssl-on-os-x.md
Last active February 27, 2025 16:31
How to set up stress-free SSL on an OS X development machine

How to set up stress-free SSL on an OS X development machine

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

@WebReflection
WebReflection / navigator.version.js
Last active December 26, 2015 06:29
navigator.version (major, minor, revision) where exposed and possibl updated to be as cross browser as possible
/** Andrea Giammarchi
* WTFPL - http://www.wtfpl.net/
*/
'version' in navigator || (
navigator.version =
/(?:(?:OS(?: X)?|Android|Windows(?: NT)) |(?:IEMobile|Version|webOS|Nokia\w+)\/)(\d+)[_.](\d+)(?:[_.](\d+(?:\.\d+)?))?/
.test(navigator.userAgent) ?
{
major: RegExp.$1,
minor: RegExp.$2 || '0',
@debasishg
debasishg / gist:8172796
Last active April 20, 2025 12:45
A collection of links for streaming algorithms and data structures

General Background and Overview

  1. Probabilistic Data Structures for Web Analytics and Data Mining : A great overview of the space of probabilistic data structures and how they are used in approximation algorithm implementation.
  2. Models and Issues in Data Stream Systems
  3. Philippe Flajolet’s contribution to streaming algorithms : A presentation by Jérémie Lumbroso that visits some of the hostorical perspectives and how it all began with Flajolet
  4. Approximate Frequency Counts over Data Streams by Gurmeet Singh Manku & Rajeev Motwani : One of the early papers on the subject.
  5. [Methods for Finding Frequent Items in Data Streams](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.187.9800&rep=rep1&t

MDB is unlike most debuggers you've experienced.

It is not a source level debugger like gdb or lldb or even Node's builtin debugger

Generally used for postmortem analysis.

Postmortem is for Production and Development

We operate mostly on core files, though you can attach to running processes as well.

@tonybruess
tonybruess / Username limitations for various services.txt
Last active August 14, 2024 22:29
Username limitations for various services
Skype
Min: 6
Max: 32
Can contain: a-z A-Z 0-9 . , _ -
Other: Must start with a letter
Twitter
Min: 1
Max: 15
Can contain: a-z A-Z 0-9 _