Skip to content

Instantly share code, notes, and snippets.

@roman-bgonz
roman-bgonz / uppercase-object-key.js
Last active February 17, 2023 00:58
Uppercase object key name
const obj = {name: "Name", position: "developer"}
const keyToUpper = (obj: any) =>
Object.keys(obj).reduce((acc, k) => {
acc[k.toUpperCase()] = obj[k];
return acc;
}, {});
console.log(keyToUpper(obj))
@roman-bgonz
roman-bgonz / js-page-title.html
Created February 14, 2023 23:51
Changes title to tab when user changes to another tab
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>Page Title</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" type="text/css" media="screen" href="main.css" />
<script>
// Our current page title
@roman-bgonz
roman-bgonz / notification.html
Created February 16, 2023 15:03
Javascript notifications
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>Javascript Notification</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" type="text/css" media="screen" href="main.css" />
</head>
<body>