Although this isn't a problem in other languages, because of semicolon insertion, there could be problems if you don't place the bracket on the opening line:
// no:
function()
{
const count = 10e6 | |
const length = 100 | |
console.time('generate') | |
const chars = Array(52).fill().map((_, i) => String.fromCharCode(i < 26 ? i + 65 : i + 71)) | |
const char = () => chars[Math.random() * chars.length | 0] | |
const triplets = chars.flatMap(a => chars.flatMap(b => chars.flatMap(c => [a, b, c].join('')))) | |
const triplet = () => triplets[Math.random() * triplets.length | 0] | |
const main = Array(Math.floor(length / 3)).fill(0) | |
const tail = Array(length - main.length * 3).fill(0) |
[ | |
[ | |
["esc", "1", "2", "3", "/", "\\", "fn","del"], | |
[ "⇥", "4", "5", "6", "[", "]", "'", "⇦"], | |
[ "`", "7", "8", "9", "0", "-", "=", ";"], | |
[ "q", "j", "l", "m", "f", "y", "p", "↩"], | |
[ "z", ".", "o", "r", "s", "u", "c", "b"], | |
[ "x", "a", "e", "h", "t", "d", "g", "k"], | |
[ "↥", ",", "i", "n", "w", "v", "↑", "↥"], | |
["ctr","sup","alt", " ", " ", "←", "↓", "→"] |
const send = (file) => { | |
const xhr = new XMLHttpRequest(); | |
const formData = new FormData(); | |
formData.append("avatar", file); | |
xhr.open("POST", "/", true); | |
xhr.upload.onprogress = function(event) { | |
if (event.lengthComputable) { | |
const percent = (event.loaded / event.total) * 100; |
private emailValidators = [ | |
Validators.maxLength(250), | |
Validators.minLength(5), | |
Validators.pattern(/.+@.+\..+/) | |
]; | |
ngOnInit() { | |
this.myForm = this.fb.group({ | |
myCheckbox: [''], | |
myEmailField: ['', this.emailValidators] |
this.myForm.get('myCheckbox').valueChanges.subscribe((value) => { | |
if (value) { | |
this.myForm.get('myEmailField').setValidators(Validators.required); | |
} else { | |
this.myForm.get('myEmailField').clearValidators(); | |
} | |
}); |
<h2>My form</h2> | |
<form [formGroup]="myForm" (ngSubmit)="onSubmit()"> | |
<div> | |
Make email mandatory <input formControlName="myCheckbox" | |
type="checkbox"> | |
</div> | |
<div> | |
Email: <input formControlName="myEmailField" | |
type="email"> |
ngOnInit() { | |
this.myForm = this.fb.group({ | |
myCheckbox: [''], | |
myEmailField: [ | |
'', | |
[ | |
Validators.maxLength(250), | |
Validators.minLength(5), | |
Validators.pattern(/.+@.+\..+/), | |
], |
const puppeteer = require('puppeteer') | |
let anime = {} | |
async function run (searched) { | |
searched = searched.replace(';', ' ') | |
// Setup pupeteer | |
const browser = await puppeteer.launch({ | |
headless: false, | |
}) |
'use strict'; | |
var path = require('path'); | |
var webpack = require('webpack'); | |
var HtmlWebpackPlugin = require('html-webpack-plugin'); | |
var ExtractTextPlugin = require('extract-text-webpack-plugin'); | |
var WriteFilePlugin = require('write-file-webpack-plugin'); | |
var BrowserSyncPlugin = require('browser-sync-webpack-plugin'); | |
const devServer = { |