Manually sorted by browsing most starred JS projects on GitHub (client-side only, all the Node crowd uses 2 spaces).
- Backbone
- Underscore
- D3
| <!DOCTYPE html> | |
| <head> | |
| <title>Test</title> | |
| </head> | |
| <body> | |
| <button onclick="displayResult()">Search</button> | |
| <script> | |
| var numEvals; | |
| function displayResult() { |
| L.TileLayer.CloudMade = L.TileLayer.extend({ | |
| options: { | |
| maxZoom: 18, | |
| attribution: 'Map data © 2011 <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © 2011 <a href="http://cloudmade.com">CloudMade</a>' | |
| }, | |
| initialize: function(key, styleId, options) { | |
| var url = 'http://{s}.tile.cloudmade.com/{key}/{styleId}/256/{z}/{x}/{y}.png', | |
| urlParams = {key: key, styleId: styleId || 997}; |
| // 100-score solution for http://codility.com/demo/take-sample-test/ | |
| function equi(array) { | |
| var i, | |
| len = array.length, | |
| sum = 0, | |
| leftSum = 0, | |
| rightSum; | |
| for (i = 0; i < len; i++) { |
| // Lefalet shortcuts for common tile providers - is it worth adding such 1.5kb to Leaflet core? | |
| L.TileLayer.Common = L.TileLayer.extend({ | |
| initialize: function (options) { | |
| L.TileLayer.prototype.initialize.call(this, this.url, options); | |
| } | |
| }); | |
| (function () { | |
| var map = new L.Map('map'); | |
| map.setView(new L.LatLng(51.505, -0.09), 13); | |
| var cloudmade = new L.TileLayer('http://{s}.tile.cloudmade.com/.../{z}/{x}/{y}.png', { | |
| attribution: '[...]' | |
| }); | |
| map.addLayer(cloudmade); | |
| var marker = new L.Marker(new L.LatLng(51.5, -0.09)); | |
| marker.bindPopup("<b>Hello world!</b><br />I am a popup.").openPopup(); |
| var geojson = L.geoJson(data, { | |
| // style for all vector layers (color, opacity, etc.), either function or object (optional) | |
| style: function (feature) { | |
| return feature.properties && feature.properties.style; | |
| }, | |
| // function for creating layers for GeoJSON point features (optional) | |
| pointToLayer: function (feature, latlng) { | |
| return L.marker(latlng, { |
| // 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 | |
| }); |