TLDR: Use for...of instead of forEach() in asynchronous code.
For legacy browsers, use for(...;...;...) or [].reduce()
To execute the promises in parallel, use Promise.all([].map(...))
| from django.db import models | |
| class Animal(models.Model): | |
| class AnimalType(models.TextChoices): | |
| ANTELOPE = 'A', 'Antelope' | |
| BAT = 'B', 'Bat' | |
| COUGAR = 'C', 'Cougar' | |
| animal_type = models.CharField(max_length=1, choices=AnimalType.choices, default=AnimalType.ANTELOPE) |
| { | |
| "compilerOptions": { | |
| /* Basic Options */ | |
| "target": "esnext" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */, | |
| "module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */, | |
| "lib": [ | |
| "esnext", | |
| "dom" | |
| ] /* Specify library files to be included in the compilation. */, | |
| // "allowJs": true, /* Allow javascript files to be compiled. */ |
⚠️ This article is outdated: Global CSS is an anti-pattern; components should be individually styled using tools such as styled-components. See Fix for the most recent, though still outdated styles from this article.
Most start their front end styles by throwing in a reset such as Eric Myer’s or the more fashionable normalize.css. I will say a few nasty things about both approaches before I present to you the perfectionist alternative: Your own custom foundation.
Foundation is a good word for a different approach. Resets strip user agent default styles back. Normalizing attempts to even out the differences and fix a few things. A foundation strips and adds style
| #!/usr/bin/env node | |
| const fs = require('fs'); | |
| const http = require('http'); | |
| const home = process.env.HOME; | |
| const options = { | |
| host: 'example.com', | |
| path: '/', |
| 'use strict'; | |
| /** | |
| * Basic code to parse the values in the "data" attribute in a Google Maps URL to an Array. | |
| * There will likely still be some work to do to interpret the resulting Array. | |
| * | |
| * Based on information from: | |
| * http://stackoverflow.com/a/34275131/1852838 | |
| * http://stackoverflow.com/a/24662610/1852838 | |
| */ |
| import os | |
| import sys | |
| import vlc | |
| import pygame | |
| def callback(self, player): | |
| print 'FPS =', player.get_fps() | |
| print 'time =', player.get_time(), '(ms)' |