Skip to content

Instantly share code, notes, and snippets.

View modster's full-sized avatar

EM Greeff modster

View GitHub Profile
@modster
modster / index.html
Created April 24, 2023 05:18 — forked from prof3ssorSt3v3/index.html
Code from video on color-scheme and prefers-color-scheme
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>color-scheme and prefers-color-scheme</title>
<meta name="color-scheme" content="light dark" />
@modster
modster / app.js
Last active April 24, 2023 01:57 — forked from prof3ssorSt3v3/app.js
Code for Service Workers 8 - Messaging between Clients and Workers
const APP = {
SW: null,
init() {
//called after DOMContentLoaded
//register our service worker
APP.registerSW();
document
.getElementById('colorForm')
.addEventListener('submit', APP.saveColor);
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>CSS Backgrounds</title>
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="main.css" />
<!--
MDN background reference
https://developer.mozilla.org/en-US/docs/Web/CSS/background
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>CSS Backgrounds</title>
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="main.css" />
<!--
MDN background reference
https://developer.mozilla.org/en-US/docs/Web/CSS/background
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Using FormData to ParseForms</title>
<link
href="https://fonts.googleapis.com/css2?family=Montserrat:wght@100;300;600&display=swap"
rel="stylesheet"
/>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Document</title>
<!--
Combining async await with fetch
-->
/***
* Dynamic Object properties using square brackets
*/
let beverage = 'Beer';
const myObj = {
a: 1,
b: 2,
c: 3,
food: 'cheese',
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>CSS Grid &amp; grid-auto-flow</title>
<style>
*{
box-sizing: border-box;
}
.box{
@modster
modster / 2019-https-localhost.md
Created April 17, 2023 03:57 — forked from cecilemuller/2019-https-localhost.md
How to create an HTTPS certificate for localhost domains

How to create an HTTPS certificate for localhost domains

This focuses on generating the certificates for loading local virtual hosts hosted on your computer, for development only.

Do not use self-signed certificates in production ! For online certificates, use Let's Encrypt instead (tutorial).

self.addEventListener('message', (ev)=>{
//console.log('Web worker started with data: ', ev.data);
let data = ev.data.do;
switch(data){
// case 'Get Started':
// self.postMessage('Web Worker Started');
// break;
// case 'Other':
// self.postMessage('Other task...');