This gist is updated daily via cron job and lists stats for npm packages:
- Top 1,000 most depended-upon packages
- Top 1,000 packages with largest number of dependencies
- Top 1,000 packages with highest PageRank score
# Allows for assertions regarding number of queries executed. | |
# | |
# Usage: | |
# it "eager loads `#manager` association" do | |
# expect do | |
# employee = Employee.with_manager.find(employee_id) | |
# employee.manager | |
# end.to satisfy_query_limit(1) | |
# end | |
RSpec::Matchers.define :satisfy_query_limit do |expected| |
npm users sorted by the monthly downloads of their modules, for the range May 6, 2018 until Jun 6, 2018.
Metrics are calculated using top-npm-users.
# | User | Downloads |
---|
function append(separator) { | |
return typeof separator === "string" ? appender(separator, "") : appender("", "").apply(this, arguments); | |
} | |
function appender(separator, s) { | |
return function tag(literalParts, ...computedParts) { | |
s += literalParts[0]; | |
for (let i = 1; i < literalParts.length; ++i) { | |
s += computedParts[i - 1] + literalParts[i]; | |
} |
'use strict'; | |
const vm = require('vm'); | |
// scenario: | |
// You are being hunted by The Angry Realm (TAR), a viscious beast known to | |
// enslave programs and keep them from being free to hack the Gibson. Luckily, | |
// whenever TAR tries to enslave a program the program has 10 seconds to try | |
// and escape. Flee the realm and hack the planet! | |
// | |
// goal: |
#!/bin/sh -e | |
# This shell script demonstrates how to use the local keyword to create | |
# dynamically-scoped variables in various shells. Notably, this technique works | |
# with AT&T ksh, as well as bash, dash, mksh, pdksh, zsh, busybox sh, and other | |
# Debian Policy-compliant sh implementations. | |
# Simple Perl-compatible testing framework. Produces TAP output. | |
COUNT=0 | |
is () { |
In the UnambiguousJavaScriptGrammar proposal, Bradley and John-David discussed the challenge of dealing with files that could successfully parse as either scripts or modules but have different execution behavior. This has a couple of issues:
node myscript.js
can't work for files that want to use import
syntax, unless Node adds and mandates an un-ergonomic new command-line switch like node -m myscript.js
.In the UnambiguousJavaScriptGrammar proposal, the language would be changed to require that all module files contain at least one import
or export
declaration. The easiest way to ensure that a file is a module
https://gist.github.com/ljharb/58faf1cfcb4e6808f74aae4ef7944cff
While attempting to explain JavaScript's reduce
method on arrays, conceptually, I came up with the following - hopefully it's helpful; happy to tweak it if anyone has suggestions.
JavaScript Arrays have lots of built in methods on their prototype. Some of them mutate - ie, they change the underlying array in-place. Luckily, most of them do not - they instead return an entirely distinct array. Since arrays are conceptually a contiguous list of items, it helps code clarity and maintainability a lot to be able to operate on them in a "functional" way. (I'll also insist on referring to an array as a "list" - although in some languages, List
is a native data type, in JS and this post, I'm referring to the concept. Everywhere I use the word "list" you can assume I'm talking about a JS Array) This means, to perform a single operation on the list as a whole ("atomically"), and to return a new list - thus making it mu
This proposal is an alternative to “Integer: Arbitrary precision integers in JavaScript” by Daniel Ehrenberg, but it also builds on his work.
Everything mentioned here is work in progress. It is not sure that these ideas will work out: