TLDR: Use for...of
instead of forEach()
in asynchronous code.
For legacy browsers, use for...i
or [].reduce()
To execute the promises in parallel, use Promise.all([].map(...))
MIT License | |
Copyright (c) 2018 Noel Bundick | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is | |
furnished to do so, subject to the following conditions: |
/* global chrome, MediaRecorder, FileReader */ | |
chrome.runtime.onConnect.addListener(port => { | |
let recorder = null | |
port.onMessage.addListener(msg => { | |
console.log(msg); | |
switch (msg.type) { | |
case 'REC_STOP': | |
console.log('Stopping recording') | |
if (!port.recorderPlaying || !recorder) { |
import React from "react"; | |
import { render } from "react-dom"; | |
import Task from "data.task"; | |
import TaskComponent from "./TaskComponent"; | |
const users = [ | |
{ id: 1, name: "User A", points: 45 }, | |
{ id: 2, name: "User B", points: 22 }, | |
{ id: 3, name: "User C", points: 79 }, | |
{ id: 4, name: "User D", points: 54 } |
{ | |
"window.zoomLevel": -1, | |
"editor.fontFamily": "Operator Mono, Menlo, Monaco, 'Courier New', monospace", | |
"editor.fontSize": 29, | |
"editor.lineHeight": 40, | |
"editor.letterSpacing": 0.5, | |
"workbench.editor.tabSizing": "shrink", | |
"eslint.autoFixOnSave": true, | |
"eslint.alwaysShowStatus": true, | |
"html.format.enable": true, |
<!DOCTYPE html> | |
<html lang="en-US"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Speech transcription</title> | |
<style> | |
#transcriptionResults { | |
width: 100%; | |
height: 500px; | |
} |
Make sure you've read the Angular.io CONTRIBUTING.md before starting out.
Follow these steps when you are setting up the repo locally for the first time and would like to view your changes in the browser as you edit.
In terminal:
upload(files) { | |
const config = { | |
onUploadProgress: function(progressEvent) { | |
var percentCompleted = Math.round((progressEvent.loaded * 100) / progressEvent.total) | |
console.log(percentCompleted) | |
} | |
} | |
let data = new FormData() | |
data.append('file', files[0]) |
<?php | |
/** | |
* Plugin Name: Page List Optimizer | |
* Description: Push Front Page & Posts Page & Privacy Page to top of admin list | |
* Plugin URI: https://torstenlandsiedel.de | |
* Version: 1.0 | |
* Author: Torsten Landsiedel | |
* Author URI: http://torstenlandsiedel.de | |
* Licence: GPL 2 | |
* License URI: http://opensource.org/licenses/GPL-2.0 |
function slugify(string) { | |
const a = 'àáâäæãåāăąçćčđďèéêëēėęěğǵḧîïíīįìıİłḿñńǹňôöòóœøōõőṕŕřßśšşșťțûüùúūǘůűųẃẍÿýžźż·/_,:;' | |
const b = 'aaaaaaaaaacccddeeeeeeeegghiiiiiiiilmnnnnoooooooooprrsssssttuuuuuuuuuwxyyzzz------' | |
const p = new RegExp(a.split('').join('|'), 'g') | |
return string.toString().toLowerCase() | |
.replace(/\s+/g, '-') // Replace spaces with - | |
.replace(p, c => b.charAt(a.indexOf(c))) // Replace special characters | |
.replace(/&/g, '-and-') // Replace & with 'and' | |
.replace(/[^\w\-]+/g, '') // Remove all non-word characters |