Debug Modern JavaScript with VSCode. Part of VSCode Course.
npm init -y
<template> | |
<div> | |
<a href="#" @click.prevent="show" class="w-full"> | |
<img class="w-64" :src="thumbnail"> | |
</a> | |
<div class="lightbox fixed pin z-50 flex justify-center items-center" v-if="visible" @click="hide"> | |
<div class="fixed pin-r pin-t text-white cursor-pointer text-4xl p-1 mr-2" @click.stop="hide">×</div> | |
<div class="flex"> | |
<div class="cursor-pointer self-center px-8" | |
@click.stop="prev" |
Debug Modern JavaScript with VSCode. Part of VSCode Course.
npm init -y
server { | |
listen 80 default_server; | |
root /var/www; | |
location / { | |
set $cors ''; | |
set $cors_allowed_methods 'OPTIONS, HEAD, GET'; | |
if ($http_origin ~ '^https?://(www\.)?example.com$') { | |
set $cors 'origin_matched'; |
#!/bin/bash | |
if [ $# -ne 1 ]; then | |
echo "Usage: $0 <submodule full name>" | |
exit 1 | |
fi | |
MODULE_NAME=$1 | |
MODULE_NAME_FOR_SED=$(echo $MODULE_NAME | sed -e 's/\//\\\//g') |
dist/main.css
grows by 400K!/\.wp-/
, /\.post-type/
, /myfancylightbox/
.../resource/assets/styles
!/node_modules/**/*
only?purgecss start ignore
, strategically placed, to the rescue!// Inspired by https://twitter.com/coderitual/status/1112297299307384833 and https://tapajyoti-bose.medium.com/7-killer-one-liners-in-javascript-33db6798f5bf | |
// Remove any duplicates from an array of primitives. | |
const unique = [...new Set(arr)] | |
// Sleep in async functions. Use: await sleep(2000). | |
const sleep = (ms) => (new Promise(resolve => setTimeout(resolve, ms))); | |
// or | |
const sleep = util.promisify(setTimeout); |
This fork of JamieMason's implementation changes the key
parameter to be an array of keys instead of just a single key. This makes it possible to group by multiple properties instead of just one.
const groupBy = keys => array =>
array.reduce((objectsByKeyValue, obj) => {
const value = keys.map(key => obj[key]).join('-');
{ | |
"ABW": { | |
"sw": { | |
"lat": 12.1702998, | |
"lon": -70.2809842 | |
}, | |
"ne": { | |
"lat": 12.8102998, | |
"lon": -69.6409842 | |
} |