Manually sorted by browsing most starred JS projects on GitHub (client-side only, all the Node crowd uses 2 spaces).
- Backbone
- Underscore
- D3
// 0.3 way | |
var icon = new L.Icon('icon.png'); | |
// 0.4 way | |
var icon = new L.Icon({iconUrl: 'icon.png'}); // or just "L.icon(...)" |
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<title>SVG Swarm</title> | |
<style> | |
svg { | |
position: absolute; | |
top: 0; | |
} |
L.Marker.addInitHook(function () { | |
// do some additional stuff in the constructor, e.g.: | |
this.on('click', doExcitingStuff); | |
// will be called for all instances of Marker | |
}); |
L.Map.prototype._onZoomTransitionEnd = function () { | |
if (!this._animatingZoom) { return; } | |
this._animatingZoom = false; | |
L.DomUtil.removeClass(this._mapPane, 'leaflet-zoom-anim'); | |
L.Util.requestAnimFrame(function () { | |
this._resetView(this._animateToCenter, this._animateToZoom, true, true); |
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | |
var metrics = require('./metrics'); | |
var len = 25; | |
var colors = []; | |
function randomizeColors() { | |
colors = []; | |
for (var i = 0; i < 500; i++) colors.push(randomColor()); | |
} |
~/projects/test → npm -v | |
2.14.4 | |
~/projects/test → npm cache clean | |
~/projects/test → time npm install eslint | |
eslint@1.8.0 node_modules/eslint | |
├── escape-string-regexp@1.0.3 | |
├── object-assign@2.1.1 | |
├── path-is-absolute@1.0.0 | |
├── path-is-inside@1.0.1 | |
├── xml-escape@1.0.0 |
'use strict'; | |
var fs = require('fs'); | |
var path = require('path'); | |
function lazyRead(path, chunkFn, done) { | |
var input = fs.createReadStream(path) | |
.on('readable', handleReadable) | |
.on('end', handleEnd); |
'use strict'; | |
// ported from http://iamtrask.github.io/2015/07/12/basic-python-network/ | |
const ndarray = require('ndarray'); | |
const ops = require('ndarray-ops'); | |
const matrix = (rows, cols, data) => ndarray(new Float32Array(data || (rows * cols)), [rows, cols]); | |
const sigmoid = (out, a) => { |
CM.GeoXML.prototype = { | |
// ... | |
_parseKmlStyle: function(obj) { | |
var style = {}; | |
if (obj.LineStyle) { | |
if (obj.LineStyle.color) { | |
var color = this._parseKmlColor(obj.LineStyle.color.$); | |
style.color = color.rgb; | |
style.opacity = color.opacity; | |
//TODO: colorMode=random |