Skip to content

Instantly share code, notes, and snippets.

@janegca
janegca / display-run-in.html
Created November 25, 2020 18:43
Example of using the 'display: run-in' property
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<style>
body {
font-size: calc(1rem + 0.5vw);
}
@janegca
janegca / randomIntInRangeOf.js
Created October 21, 2020 12:48
Function returns a random number in the given range
/* Generating Random Numbers
Math.random() returns a number between 0 and 0.99999999
This function returns a number in the range of 'min <= n <= max'
Source:
Academind.com 'JavaScript - The Complete Guide 2020'
randomIntBetween(min,max) in the Numbers and Strings module
*/
function randomIntInRangeOf(min, max) {
return Math.floor(Math.random() * (max - min + 1) + min);
}
@janegca
janegca / format-code-block.html
Created September 8, 2020 22:35
Formatting a code block in an HTML document
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Display Formatted Code Block</title>
<style>
body {
font-size: 1.5rem;
}