View top100.md
View What's most commonly used with redux?
# Top 50 package most commonly used with redux.
react used 113 times
react-redux used 107 times
babel used 77 times
babel-core used 70 times
react-dom used 61 times
babel-loader used 61 times
webpack used 60 times
mocha used 58 times
View 00.Intro.md

npm rank

This gist is updated daily via cron job and lists stats for npm packages:

  1. Top 1,000 most depended-upon packages
  2. Top 1,000 packages with largest number of dependencies
  3. Top 1,000 packages with highest PageRank score
View jquery versions on npm
Results generated by https://github.com/anvaka/npmrank
> node countVersions.js jquery
Counting packages that depend on jquery...
[ { version: '^2.1.4', dependents: 319 },
{ version: '^2.1.3', dependents: 296 },
{ version: '^2.1.1', dependents: 239 },
{ version: '*', dependents: 121 },
{ version: '~2.1.0', dependents: 84 },
{ version: '~1.8.3', dependents: 63 },
View index.js
// run:
// echo {} > package.json
// npm i byline ngraph.graph ngraph.pagerank
var byline = require('byline');
var fs = require('fs');
var g = require('ngraph.graph')();
var pagerank = require('ngraph.pagerank');
var stream = byline.createStream(fs.createReadStream('web-Google.txt', { encoding: 'utf8' }));
View modules.md

This excercise computes PageRank of npm dependencies graph.

  1. Download all npm modules: wget https://skimdb.npmjs.com/registry/_design/scratch/_view/byField
  2. Convert them into ngraph.graph using convertToGraph.js script.
  3. Run rank.js (see below):

Number of nodes: 123,969; Number of edges: 281,471; PageRank computed in 1,187 ms;

  1. underscore - 0.0132458168541106
  2. lodash - 0.012808245947189859
View index.js
var addWheelListener = require('wheel');
addWheelListener(document.body, function (e) {
console.log(e);
});
View top-github.md

I was playing with GitHub Archive recently. Out of curiosity I ran this query:

SELECT COUNT(repository_owner) as totalStars, repository_owner
FROM [githubarchive:github.timeline] 
WHERE type = 'WatchEvent'
GROUP BY repository_owner
ORDER BY totalStars DESC
LIMIT 1000
View require from html.md

Browserify and HTML

Today most people include bundle.js into their html:

<!-- index.html -->
<!DOCTYPE html>
<html lang="en">
<head>
  <title>javascript first</title>