Skip to content

Instantly share code, notes, and snippets.

@lukehorvat
lukehorvat / es6-map-to-object-literal.js
Last active January 8, 2024 10:32
Convert ES6 Map to Object Literal
let map = new Map();
map.set("a", 1);
map.set("b", 2);
map.set("c", 3);
let obj = Array.from(map).reduce((obj, [key, value]) => (
Object.assign(obj, { [key]: value }) // Be careful! Maps can have non-String keys; object literals can't.
), {});
console.log(obj); // => { a: 1, b: 2, c: 3 }
@davestewart
davestewart / broadcast-channel.md
Last active April 1, 2024 16:47
Example of using BroadcastChannel to communicate with pages in the same domain

screenshot

@gokulkrishh
gokulkrishh / media-query.css
Last active April 24, 2024 17:27
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
/* CSS */
@qoomon
qoomon / conventional_commit_messages.md
Last active April 25, 2024 09:51
Conventional Commit Messages

Conventional Commit Messages

See how a minor change to your commit message style can make a difference.

Tip

Have a look at git-conventional-commits , a CLI util to ensure these conventions and generate verion and changelogs

Commit Message Formats

Default