import {chunk, zipObject} from 'lodash-es';
console.log(zipObject(chunk(['a', 'b', 'c', 'd'], 2)));$ rollup -f=iife demo.js > output.jsimport {chunk, zipObject} from 'lodash-es';
console.log(zipObject(chunk(['a', 'b', 'c', 'd'], 2)));$ rollup -f=iife demo.js > output.js| var monthNames = [ | |
| 'January', 'February', 'March', 'April', 'May', 'June', 'July', | |
| 'August', 'September', 'October', 'November', 'December' | |
| ]; | |
| function formatDate(date) { | |
| return ( | |
| monthNames[date.getUTCMonth()] + ' ' + | |
| date.getUTCDate() + ', ' + | |
| date.getUTCFullYear() |
| <link rel="import" href="../ace-element/ace-element.html"> | |
| <link rel="import" href="../topeka-elements/category-images.html"> | |
| <link rel="import" href="../core-icon/core-icon.html"> | |
| <link rel="import" href="../core-icons/core-icons.html"> | |
| <link rel="import" href="../core-icons/av-icons.html"> | |
| <link rel="import" href="../paper-fab/paper-fab.html"> | |
| <link rel="import" href="../topeka-elements/category-icons.html"> | |
| <polymer-element name="my-element"> |
| /* | |
| UPDATED for 2023 - Now much simpler. The old tricks are no longer needed. | |
| The following code makes an 800×600 canvas that is always as sharp as possible for the device. | |
| You still draw on it as if it's the logical size (800×600 in this case), but everything just | |
| looks sharper on high-DPI screens. Regular non-sharp screens are not affected. | |
| */ | |
| const width = 800 |
| // convert three r,g,b integers (each 0-255) to a single decimal integer (something between 0 and ~16m) | |
| function colourToNumber(r, g, b) { | |
| return (r << 16) + (g << 8) + (b); | |
| } | |
| // convert it back again (to a string) | |
| function numberToColour(number) { | |
| const r = (number & 0xff0000) >> 16; | |
| const g = (number & 0x00ff00) >> 8; |
In response to a Stack Overflow question regarding centering a map given a GeoJSON object.
| "use strict"; | |
| module.exports = function isSimpleClick(event) { | |
| var isLeft = true; | |
| var which = event.which; | |
| if (!which && event.button != null) { | |
| which = event.button & 1 ? 1 : event.button & 2 ? 3 : event.button & 4 ? 2 : 0; | |
| } |
| # make sure you have these installed: | |
| npm install --global browserify uglify-js | |
| # example command for 'chalk': | |
| echo "var chalk = (function(){var _ref;" `echo "_ref = require('chalk');" | browserify --bare - | uglifyjs` "return _ref;}).call(this);" > bundled.js |
These projections are available in the geo.projection plugin.
| var modules = require('fs').readdirSync('node_modules').filter(function (name) {return name !== '.bin'}); | |
| modules.forEach(function (m) { | |
| console.time(m); | |
| require(m); | |
| console.timeEnd(m); | |
| }); |