When making this website, i wanted a simple, reasonable way to make it look good on most displays. Not counting any minimization techniques, the following 58 bytes worked well for me:
main {
max-width: 38rem;
padding: 2rem;
margin: auto;
}| const ROMAN_ARABIC_CONVERSION = { | |
| I: 1, | |
| V: 5, | |
| X: 10, | |
| L: 50, | |
| C: 100, | |
| D: 500, | |
| M: 1_000, | |
| V̅: 5_000, | |
| X̅: 10_000, |
| /// <reference path="../../library.test.d.ts"/> | |
| import * as angular from "angular"; angular; | |
| import * as mocks from "angular-mocks/ngMock"; mocks; | |
| describe('feat(localStorage Mock): ', function() { | |
| beforeAll(() => { | |
| angular.module('mock-module',[]) | |
| }); |
| ;;;; | |
| ; npm userconfig file | |
| ; this is a simple ini-formatted file | |
| ; lines that start with semi-colons are comments. | |
| ; read `npm help config` for help on the various options | |
| ;;;; | |
| ;;;; | |
| ; all options with default values | |
| ;;;; |
I'm not suggesting drastic action. I don't want to break backwards compatibility. I simply want to make the class feature more usable to a broader cross section of the community. I believe there is some low-hanging fruit that can be harvested to that end.
Imagine AutoMaker contained class Car, but the author wants to take advantage of prototypes to enable factory polymorphism in order to dynamically swap out implementation.
Stampit does something similar to this in order to supply information needed to inherit from composable factory functions, known as stamps.
This isn't the only way to achieve this, but it is a convenient way which is compatible with .call(), .apply(), and .bind().
| { | |
| // http://eslint.org/docs/rules/ | |
| "ecmaFeatures": { | |
| "binaryLiterals": false, // enable binary literals | |
| "blockBindings": false, // enable let and const (aka block bindings) | |
| "defaultParams": false, // enable default function parameters | |
| "forOf": false, // enable for-of loops | |
| "generators": false, // enable generators | |
| "objectLiteralComputedProperties": false, // enable computed object literal property names |
| /** | |
| * @param {Function} fn Function to curry. | |
| * @param {Number} lenght The arguments required to invoke the function. Optional. By default is fn.length | |
| * @returns {Function} The currified function. | |
| */ | |
| function curry(fn, length) { | |
| length = length || fn.length; | |
| return function currified() { | |
| var args = [].slice.call(arguments); |
| /** | |
| * Get a random floating point number between `min` and `max`. | |
| * | |
| * @param {number} min - min number | |
| * @param {number} max - max number | |
| * @return {number} a random floating point number | |
| */ | |
| function getRandomFloat(min, max) { | |
| return Math.random() * (max - min) + min; | |
| } |
| var parser = document.createElement('a'); | |
| parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
| parser.protocol; // => "http:" | |
| parser.hostname; // => "example.com" | |
| parser.port; // => "3000" | |
| parser.pathname; // => "/pathname/" | |
| parser.search; // => "?search=test" | |
| parser.hash; // => "#hash" | |
| parser.host; // => "example.com:3000" |