Skip to content

Instantly share code, notes, and snippets.

View heapwolf's full-sized avatar
🕷️
Vault of the Black Spiders

heapwolf heapwolf

🕷️
Vault of the Black Spiders
View GitHub Profile
@heapwolf
heapwolf / es5check.js
Created November 29, 2010 04:30
identify ES5 functions that are not implemented in a browser (returns an object literal of arrays that contain the names of the missing functions)
var issues = (function() {
var o = {
"Array.prototype": "forEach map reduce reduceRight filter every some indexOf lastIndexOf",
"Array": "isArray",
"Object": "keys preventExtensions isExtensible getOwnPropertyDescriptor defineProperty getOwnPropertyNames create seal isSealed freeze isFrozen"
};
for(var l in o) {
o[l] = o[l].split(" ");
for(var f=0; f<o[l].length; f++) {
@heapwolf
heapwolf / arrayDiff.js
Created January 23, 2011 13:42
array diff
Array.diff = function(left, right)
{
var o = left;
var n = right;
var ns = {};
var os = {};
for (var i = 0; i < n.length; i++) {
if (ns[n[i]] == null)
@heapwolf
heapwolf / sesh.js
Created March 3, 2011 17:26
A simplified way to store script state across browser refreshes.
;(function() {
return window.sesh = {
init: function() {
var self = this;
window.addEventListener('unload', function() {
self.serialize();
}, false);
self.parse();
},
@qrush
qrush / Inconsolata-dz-Powerline.otf
Created January 11, 2012 16:50
vim-powerline patched fonts
@heapwolf
heapwolf / z.js
Created February 26, 2012 18:10
z
//
// an experimental flow control library.
// please dont ever use this for anything.
//
var z = function z(f) {
if (!(this instanceof z)) {
return new z(f);
}
@TooTallNate
TooTallNate / why.md
Created May 26, 2012 18:28
Why is Node async?

Why is Node async?

  • Asynchronous code is how you write low-resource, high-concurrency servers. See http://www.kegel.com/c10k.html.
  • Node embracing async from the get-go means that servers are low-resource, high-concurrency by default.
  • Async + JavaScript = Perfect fit for an event loop.
  • When it comes to threads vs event-loop, there are times when either are advantageous.
    • But there are things very hard or impossible to do with threads.
    • WebSockets are difficult to do properly with threads. That's one example where non-blocking IO (async) has a major advantage.
    • RAM usage is another factor, especially when we're talking about the physical hardware required to run your application, which translates to real dollars.
  • It depends on your application in the end:
@WebReflection
WebReflection / Object.extra.js
Created August 16, 2012 20:42
Object.getPropertyDescriptor and Object.getPropertyNames
!function(Object, getPropertyDescriptor, getPropertyNames){
// (C) WebReflection - Mit Style License
if (!(getPropertyDescriptor in Object)) {
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
Object[getPropertyDescriptor] = function getPropertyDescriptor(o, name) {
var proto = o, descriptor;
while (proto && !(
descriptor = getOwnPropertyDescriptor(proto, name))
) proto = proto.__proto__;
return descriptor;
@max-mapper
max-mapper / readme.md
Last active June 3, 2020 00:31
automatically scan for and join open internet enabled wifi networks on linux using node.js (tested on raspberry pi raspbian)

The ultimate database of the future

What does the ultimate database look like? Maybe the ultimate database of the future going to be a many-headed hydra that will attempt to solve all problems? Maybe marketing teams are going to be at the heart of its success? Perhaps it will grow tentacles and become violent toward its creator?

Hydra

What does your current database do?

Unless you're a contributor to the software, your probably limited to understanding the value propositions and a subset of features. Maybe your an expert. Probably not. This corner is usually dark. A database has historically been a black box. You pick one that seems like the best fit and trust it.

Maybe the database of the future should just be a library, more like BerkeleyDB, I really don't want an entire server. Someone could just add a server on top of it if they really wanted one. It would also be nice if understanding it (in its entirety) wouldn't represent a big investment.

@heapwolf
heapwolf / npm-qos-heuristic.md
Last active December 11, 2015 10:38
general heuristics for ranking package quality

Health

Has CI

Tests pass

Total number of breaking commits

Number of dependencies

Average age of issue

Frequency of issues fixed

Average response time of issues fixed to bugs filed

Last commit