Skip to content

Instantly share code, notes, and snippets.

View junosuarez's full-sized avatar
💭
hi hello

juno suárez junosuarez

💭
hi hello
View GitHub Profile

One could imagine a version of Node built on a hypothetical JavaScript-sans-Arrays. In such a world, packages would have to invent array types for themselves. The lingua franca array would be a number-keyed object, and packages would have to downcast their interpretation of arrays down to number-keyed objects at their thresholds. If a package missed doing this, their definition of an array would leak into calling packages. What if contemporary arrays were introduced into this ecosystem? At some level, they're still just sugar for objects-with-numeric-keys; but they'd have the potential to give packages a global interchange datatype for arrays. At the very least users would start passing them between packages. They'd expect native Arrays to work. Eventually there would be pressure on core to adopt the native Array. Would we do it?

The result of the above hypothetical is not that arrays replace objects, it's that native Arrays replace ad-hoc definitions of arrays. Native Arrays standardize the interchange form

@junosuarez
junosuarez / b.js
Last active February 1, 2016 00:21
Typescript error with --allowJavaScript - clone with git clone git@github.com:7cd1433497897e64af9f.git
function hi () {
return 'hi'
}
module.exports = hi
// compiles fine with:
// module.exports = function hi () {
// return 'hi'
// }
By default monitoring is disabled (threshold set to 0), even if the actual cost of latency
monitoring is near zero. However while the memory requirements of latency monitoring are
very small, there is no good reason to raise the baseline memory usage of a Redis instance
that is working well.
via http://redis.io/topics/latency-monitor

hasOwnProperty check is not necessary.

the advice in Crockford's little javascript book only made sense in a time when it was more common place for people to do really silly things, like add enumerable properties to the global Object object, so it was necessary to be paranoid-level defensive at the expense of code readability. In our codebase, we know that these things aren't happening, so we should prefer readability.

@junosuarez
junosuarez / resume.md
Last active August 29, 2015 14:23
resume for jden / jason denizac

quality tested

[![quality tested](https://img.shields.io/badge/quality-tested-brightgreen.svg)](https://github.com/jden/quality)
String.prototype.c = function (b) { console.log(this); return this.concat(b) }
String.c(b)
"a".c("b")
VM2531:2 String {0: "a", length: 1, [[PrimitiveValue]]: "a"}
"ab"
("a".c)("b")
VM2531:2 String {0: "a", length: 1, [[PrimitiveValue]]: "a"}
"ab"
#!/usr/bin/env node
var path = require('path')
var exec = require('child_process').execSync
function receive(then) {
process.stdin.on('data', function (data) {
then(null, parse(data))
})
}
@junosuarez
junosuarez / a.xml
Created April 21, 2015 20:36
this is a totally reasonable translation a => b
<code value="au"/>
<code value="nz">
<extension url="http://hl7.org/fhir/Profile/tools-extensions#display">
<valueString value="New Zealand a.k.a Kiwiland"/>
</extension>
</code>
@junosuarez
junosuarez / gist:ee9039874512fd34ea20
Created March 19, 2015 18:01
log select query in transaction (postgres 9+)
DO language plpgsql $$ DECLARE result RECORD; BEGIN
select * into result from table limit 1;
RAISE NOTICE '%', result; END$$;