diff options
-rw-r--r-- | package-lock.json | 363 | ||||
-rw-r--r-- | package.json | 16 | ||||
l--------- | src/css/bootstrap.css | 1 | ||||
-rw-r--r-- | src/css/styles.css | 58 | ||||
-rw-r--r-- | src/html/bread.html | 99 | ||||
-rw-r--r-- | src/html/essay.html | 25 | ||||
-rw-r--r-- | src/html/essay/magic-division.html | 95 | ||||
-rw-r--r-- | src/html/index.html | 29 | ||||
-rw-r--r-- | src/index.js | 4 | ||||
-rw-r--r-- | src/photo/ban1.jpg | bin | 0 -> 1106159 bytes | |||
-rw-r--r-- | src/photo/ban2.jpg | bin | 0 -> 1411456 bytes | |||
-rw-r--r-- | src/photo/cider.jpg | bin | 0 -> 725680 bytes | |||
-rw-r--r-- | src/photo/first-1.jpg | bin | 0 -> 283944 bytes | |||
-rw-r--r-- | src/photo/first-2.jpg | bin | 0 -> 296466 bytes | |||
-rw-r--r-- | src/photo/flat1.jpg | bin | 0 -> 1129498 bytes | |||
-rw-r--r-- | src/photo/flat2.jpg | bin | 0 -> 905668 bytes | |||
-rw-r--r-- | src/photo/nyt1.jpg | bin | 0 -> 2142167 bytes | |||
-rw-r--r-- | src/photo/nyt2.jpg | bin | 0 -> 1286502 bytes | |||
-rw-r--r-- | src/photo/wheat.jpg | bin | 0 -> 2669180 bytes | |||
-rw-r--r-- | src/photo/white-1.jpg | bin | 0 -> 1652366 bytes | |||
-rw-r--r-- | src/photo/white-2.jpg | bin | 0 -> 1811909 bytes | |||
-rw-r--r-- | src/server.js | 33 |
22 files changed, 723 insertions, 0 deletions
diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..e29f2e7 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,363 @@ +{ + "name": "markskitchen", + "version": "1.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "accepts": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.5.tgz", + "integrity": "sha1-63d99gEXI6OxTopywIBcjoZ0a9I=", + "requires": { + "mime-types": "~2.1.18", + "negotiator": "0.6.1" + } + }, + "array-flatten": { + "version": "1.1.1", + "resolved": "http://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" + }, + "body-parser": { + "version": "1.18.3", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.3.tgz", + "integrity": "sha1-WykhmP/dVTs6DyDe0FkrlWlVyLQ=", + "requires": { + "bytes": "3.0.0", + "content-type": "~1.0.4", + "debug": "2.6.9", + "depd": "~1.1.2", + "http-errors": "~1.6.3", + "iconv-lite": "0.4.23", + "on-finished": "~2.3.0", + "qs": "6.5.2", + "raw-body": "2.3.3", + "type-is": "~1.6.16" + } + }, + "bootstrap": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-4.1.3.tgz", + "integrity": "sha512-rDFIzgXcof0jDyjNosjv4Sno77X4KuPeFxG2XZZv1/Kc8DRVGVADdoQyyOVDwPqL36DDmtCQbrpMCqvpPLJQ0w==" + }, + "bytes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", + "integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=" + }, + "content-disposition": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz", + "integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ=" + }, + "content-type": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", + "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" + }, + "cookie": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", + "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=" + }, + "cookie-signature": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" + }, + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + }, + "depd": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", + "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=" + }, + "destroy": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", + "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" + }, + "ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" + }, + "encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=" + }, + "escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" + }, + "etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=" + }, + "express": { + "version": "4.16.4", + "resolved": "https://registry.npmjs.org/express/-/express-4.16.4.tgz", + "integrity": "sha512-j12Uuyb4FMrd/qQAm6uCHAkPtO8FDTRJZBDd5D2KOL2eLaz1yUNdUB/NOIyq0iU4q4cFarsUCrnFDPBcnksuOg==", + "requires": { + "accepts": "~1.3.5", + "array-flatten": "1.1.1", + "body-parser": "1.18.3", + "content-disposition": "0.5.2", + "content-type": "~1.0.4", + "cookie": "0.3.1", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "~1.1.2", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "1.1.1", + "fresh": "0.5.2", + "merge-descriptors": "1.0.1", + "methods": "~1.1.2", + "on-finished": "~2.3.0", + "parseurl": "~1.3.2", + "path-to-regexp": "0.1.7", + "proxy-addr": "~2.0.4", + "qs": "6.5.2", + "range-parser": "~1.2.0", + "safe-buffer": "5.1.2", + "send": "0.16.2", + "serve-static": "1.13.2", + "setprototypeof": "1.1.0", + "statuses": "~1.4.0", + "type-is": "~1.6.16", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + } + }, + "finalhandler": { + "version": "1.1.1", + "resolved": "http://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz", + "integrity": "sha512-Y1GUDo39ez4aHAw7MysnUD5JzYX+WaIj8I57kO3aEPT1fFRL4sr7mjei97FgnwhAyyzRYmQZaTHb2+9uZ1dPtg==", + "requires": { + "debug": "2.6.9", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "on-finished": "~2.3.0", + "parseurl": "~1.3.2", + "statuses": "~1.4.0", + "unpipe": "~1.0.0" + } + }, + "forwarded": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", + "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=" + }, + "fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" + }, + "http-errors": { + "version": "1.6.3", + "resolved": "http://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", + "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=", + "requires": { + "depd": "~1.1.2", + "inherits": "2.0.3", + "setprototypeof": "1.1.0", + "statuses": ">= 1.4.0 < 2" + } + }, + "iconv-lite": { + "version": "0.4.23", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz", + "integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==", + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + }, + "ipaddr.js": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.8.0.tgz", + "integrity": "sha1-6qM9bd16zo9/b+DJygRA5wZzix4=" + }, + "media-typer": { + "version": "0.3.0", + "resolved": "http://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" + }, + "merge-descriptors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", + "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=" + }, + "methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=" + }, + "mime": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.4.1.tgz", + "integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ==" + }, + "mime-db": { + "version": "1.37.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.37.0.tgz", + "integrity": "sha512-R3C4db6bgQhlIhPU48fUtdVmKnflq+hRdad7IyKhtFj06VPNVdk2RhiYL3UjQIlso8L+YxAtFkobT0VK+S/ybg==" + }, + "mime-types": { + "version": "2.1.21", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.21.tgz", + "integrity": "sha512-3iL6DbwpyLzjR3xHSFNFeb9Nz/M8WDkX33t1GFQnFOllWk8pOrh/LSrB5OXlnlW5P9LH73X6loW/eogc+F5lJg==", + "requires": { + "mime-db": "~1.37.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + }, + "negotiator": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz", + "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=" + }, + "on-finished": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", + "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", + "requires": { + "ee-first": "1.1.1" + } + }, + "parseurl": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.2.tgz", + "integrity": "sha1-/CidTtiZMRlGDBViUyYs3I3mW/M=" + }, + "path-to-regexp": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", + "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" + }, + "proxy-addr": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.4.tgz", + "integrity": "sha512-5erio2h9jp5CHGwcybmxmVqHmnCBZeewlfJ0pex+UW7Qny7OOZXTtH56TGNyBizkgiOwhJtMKrVzDTeKcySZwA==", + "requires": { + "forwarded": "~0.1.2", + "ipaddr.js": "1.8.0" + } + }, + "qs": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" + }, + "range-parser": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz", + "integrity": "sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4=" + }, + "raw-body": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.3.tgz", + "integrity": "sha512-9esiElv1BrZoI3rCDuOuKCBRbuApGGaDPQfjSflGxdy4oyzqghxu6klEkkVIvBje+FF0BX9coEv8KqW6X/7njw==", + "requires": { + "bytes": "3.0.0", + "http-errors": "1.6.3", + "iconv-lite": "0.4.23", + "unpipe": "1.0.0" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "send": { + "version": "0.16.2", + "resolved": "https://registry.npmjs.org/send/-/send-0.16.2.tgz", + "integrity": "sha512-E64YFPUssFHEFBvpbbjr44NCLtI1AohxQ8ZSiJjQLskAdKuriYEP6VyGEsRDH8ScozGpkaX1BGvhanqCwkcEZw==", + "requires": { + "debug": "2.6.9", + "depd": "~1.1.2", + "destroy": "~1.0.4", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "~1.6.2", + "mime": "1.4.1", + "ms": "2.0.0", + "on-finished": "~2.3.0", + "range-parser": "~1.2.0", + "statuses": "~1.4.0" + } + }, + "serve-static": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.13.2.tgz", + "integrity": "sha512-p/tdJrO4U387R9oMjb1oj7qSMaMfmOyd4j9hOFoxZe2baQszgHcSWjuya/CiT5kgZZKRudHNOA0pYXOl8rQ5nw==", + "requires": { + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "parseurl": "~1.3.2", + "send": "0.16.2" + } + }, + "setprototypeof": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", + "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==" + }, + "statuses": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", + "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" + }, + "type-is": { + "version": "1.6.16", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.16.tgz", + "integrity": "sha512-HRkVv/5qY2G6I8iab9cI7v1bOIdhm94dVjQCPFElW9W+3GeDOSHmy2EBYe4VTApuzolPcmgFTN3ftVJRKR2J9Q==", + "requires": { + "media-typer": "0.3.0", + "mime-types": "~2.1.18" + } + }, + "unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" + }, + "utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" + }, + "vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..fc459da --- /dev/null +++ b/package.json @@ -0,0 +1,16 @@ +{ + "name": "markskitchen", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1", + "run": "sudo node src/" + }, + "author": "", + "license": "ISC", + "dependencies": { + "bootstrap": "^4.1.3", + "express": "^4.16.4" + } +} diff --git a/src/css/bootstrap.css b/src/css/bootstrap.css new file mode 120000 index 0000000..a78be59 --- /dev/null +++ b/src/css/bootstrap.css @@ -0,0 +1 @@ +../../node_modules/bootstrap/dist/css/bootstrap.css
\ No newline at end of file diff --git a/src/css/styles.css b/src/css/styles.css new file mode 100644 index 0000000..08a5f38 --- /dev/null +++ b/src/css/styles.css @@ -0,0 +1,58 @@ +body { + padding: 15px; +} + +.essay{ + width: 70%; +} + +.figure { + border: 1px solid #777777; + background-color: #dddddd; + padding: 10px; +} + +.item { + margin: 10px; + border: 2px solid #777777; + border-radius: 5px; + padding: 7px; +} + +img { + image-orientation: from-image; +} + +.card img { + width: 80%; + display: block; + margin-left: auto; + margin-right: auto; + margin-top: 2em; +} + +.sidebar { + height: 100vh; + width: 15%; + margin: 20px; +} + +.sidebar ul { + list-style: none; + padding: 0; +} + +.sidebar ul li { + display: block; + margin: 5px; + margin-left: auto; + margin-right: auto; +} + +.btn-primary { + width: 100%; + height: 2em; + border-radius: 0; + text-align: center; + font-size: 20px; +} diff --git a/src/html/bread.html b/src/html/bread.html new file mode 100644 index 0000000..af2a665 --- /dev/null +++ b/src/html/bread.html @@ -0,0 +1,99 @@ +<!doctype html> +<html lang="en"> + <head> + <title>Mark's Kitchen - Bread</title> + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> + <link rel="stylesheet" type="text/css" href="css/bootstrap.css"> + <link rel="stylesheet" type="text/css" href="css/styles.css"> + </head> + <body> + <div class="container-fluid"> + <br> + <h1>Bread</h1> + <div class="row"> + <div class="col-md"> + <div class="card"> + <div class="card-body"> + <p class="card-text">First sourdough, mainly wheat</p> + <img src="first-1.jpg"> + <img src="first-2.jpg"> + <br> + <p>Aug 9, 2018</p> + </div> + </div> + </div> + <div class="col-md"> + <div class="card"> + <div class="card-body"> + <p class="card-text">Used more white flour this time</p> + <img src="photo/white-1.jpg"> + <img src="photo/white-2.jpg"> + <br> + <p>Aug 16, 2018</p> + </div> + </div> + </div> + </div> + <div class="row"> + <div class="col-md"> + <div class="card"> + <div class="card-body"> + <p class="card-text">Severely messed up the recipie this time. Tried to double to get two loafs, both turned out flat.</p> + <img src="photo/flat1.jpg"> + <img src="photo/flat2.jpg"> + <br> + <p>Aug 30, 2018</p> + </div> + </div> + </div> + <div class="col-md"> + <div class="card"> + <div class="card-body"> + <p class="card-text">First time using a banneton, beautiful shape. Tried a different knead style too. Rye-AP mix</p> + <img src="photo/ban1.jpg"> + <img src="photo/ban2.jpg"> + <br> + <p>Sep 19, 2018</p> + </div> + </div> + </div> + </div> + <div class="row"> + <div class="col-md"> + <div class="card"> + <div class="card-body"> + <p class="card-text">I wanted to try the NY Times no knead recipie. Bread turned out delicious. Will try to tranfer to a loaf shape next time for slices.</p> + <img src="photo/nyt1.jpg"> + <img src="photo/nyt2.jpg"> + <br> + <p>Sep 27, 2018</p> + </div> + </div> + </div> + <div class="col-md"> + <div class="card"> + <div class="card-body"> + <p class="card-text">A twist on normal beer bread, using hard cider.</p> + <img src="photo/cider.jpg"> + <br> + <p>Sep 30, 2018</p> + </div> + </div> + </div> + </div> + <div class="row"> + <div class="col-md"> + <div class="card"> + <div class="card-body"> + <p class="card-text">Tried to make something more sandwich-y. 4 hour warm proof with wheat, rye, and corn flours. A bit dense, but not bad.</p> + <img src="photo/wheat.jpg"> + <br> + <p>Sep 30, 2018</p> + </div> + </div> + </div> + </div> + </div> + </body> +</html> diff --git a/src/html/essay.html b/src/html/essay.html new file mode 100644 index 0000000..a3e88e1 --- /dev/null +++ b/src/html/essay.html @@ -0,0 +1,25 @@ +<!doctype html> +<html lang="en"> + <head> + <title>Mark's Kitchen - Essay</title> + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> + <link rel="stylesheet" type="text/css" href="/css/bootstrap.css"> + <link rel="stylesheet" type="text/css" href="/css/styles.css"> + </head> + <body> + <div class="container"> + <br> + <h1>Essay</h1> + <div class="card"> + <div class="card-body"> + <p class="card-text"> + When digging through generated assembly code, some strange numbers showed + up. This essay briefly explains what was going on. + </p> + <a href="essay/magic-division.html" class="btn btn-primary">Read</a> + </div> + </div> + </div> + </body> +</html> diff --git a/src/html/essay/magic-division.html b/src/html/essay/magic-division.html new file mode 100644 index 0000000..f40048d --- /dev/null +++ b/src/html/essay/magic-division.html @@ -0,0 +1,95 @@ +<!doctype html> +<html lang="en"> + <head> + <title>Magic Division</title> + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> + + </head> + <body> + <link rel="stylesheet" type="text/css" href="/css/styles.css"> + <div class="essay"> + <h2>Magic Division -- Or Division by Integer Multiplication</h2> + + <p>I noticed something strange in the assembly generated when compiling a program + using <code>gcc</code> an optimization turned off. Here it is in <a href="#figure1">Figure 1</a> + (though using optimization level 3 just to simplify, but it still shows in level 0). + In this generated assembly, we see instead of using the <code>div</code> operator, + something strange is going on with the number 1717986919 and shifting. My first + attempts at searching for this phenomenon online were not helpful. The first result + for the number was on Amazon as a book identifier. This number also shows up on + stack overflow, however it is no more helpful. No one on the post is talking about + why this number is in the generated code (or perhaps they all know this arcane + secret and don’t wish share). Eventually, I found out what was going on. Even + with no optimization, the compiler prefers to generate multiplication operator + over the division operator. + </p> + <p>We will consider unsigned integer division first. Let + <span class="math inline"><em>d</em></span> + be some constant divisor, and <span class="math inline"><em>n</em></span> + our numerator (for now let’s make <span class="math inline"><em>n</em></span> + a multiple of <span class="math inline"><em>d</em></span>). We will assume + integers are 32 bits. In order to computer + <span class="math inline"><em>n</em>/<em>d</em></span>, + first we need to know the values <span class="math inline"><em>l</em></span> + and <span class="math inline"><em>i</em></span> where + <span class="math inline"><em>d</em> = <em>l</em>2<sup><em>i</em></sup></span>. + So to begin out division, we can shift <span class="math inline"><em>n</em></span> + by <span class="math inline"><em>i</em></span> bits. Now we must divide this result + be <span class="math inline"><em>l</em></span>. Since + <span class="math inline"><em>l</em></span> will be odd, there exists some + inverse of <span class="math inline"><em>l</em></span>, called + <span class="math inline"><em>j</em></span> where <br /> + <span class="math display"><em>l</em><em>j</em> = 1(mod 2<sup>32</sup>)</span><br /> + So for any number <span class="math inline"><em>x</em></span>, + <span class="math inline"><em>x</em>/<em>l</em> = (<em>x</em><em>j</em>)/(<em>l</em><em>j</em>)=<em>x</em><em>j</em></span>. + So now all that is left after the shift is to multiply by + <span class="math inline"><em>j</em></span>, and we will + have computed <span class="math inline"><em>n</em>/<em>d</em></span>.</p> + <p>Dealing with remainder can go pretty in depth, and I recommend + reading the chapter in Hacker’s Delight about this topic + <a class="citation" href="#hacker">[1]</a>. Another write up can be found + in the MSDN blog archive <a class="citation" href="#msdn">[2]</a>. + </p> + + <div class="figure"> + <a name="figure1"><h4>Figure 1</h4></a> + <span>Source:</span> + <div class="sourceCode" frame="single" numbers="left" language="c"> + <pre><code class="sourceCode"> +int div20(int n){ + return a/20; +} + </code></pre></div> + <span>Compiled excerpt:</span> + <div class="sourceCode" frame="single" numbers="left"> + <pre><code class="sourceCode"> +.cfi_startproc +movl %edi, %eax +movl $1717986919, %edx +sarl $31, %edi +imull %edx +sarl $3, %edx +movl %edx, %eax +subl %edi, %eax +ret +.cfi_endproc + </code></pre></div> + </div> + + <h3>References</h3> + <p><a name="hacker">1</a> Hacker’s Delight Chapter 10. + (<em><a href="http://www.hackersdelight.org/divcMore.pdf"> + http://www.hackersdelight.org/divcMore.pdf + </a> + </em>) + </p> + <p><a name="msdn">2</a> MSDN Blog Archive + (<em><a href="https://blogs.msdn.microsoft.com/devdev/2005/12/12/integer-division-by-constants/"> + https://blogs.msdn.microsoft.com/devdev/2005/12/12/integer-division-by-constants/ + </a> + </em>) + </p> + </div> + </body> +</html>
\ No newline at end of file diff --git a/src/html/index.html b/src/html/index.html new file mode 100644 index 0000000..0e15b8c --- /dev/null +++ b/src/html/index.html @@ -0,0 +1,29 @@ +<!doctype html> +<html lang="en"> + <head> + <title>Mark's Kitchen</title> + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> + <link rel="stylesheet" type="text/css" href="css/bootstrap.css"> + <link rel="stylesheet" type="text/css" href="css/styles.css"> + </head> + <body> + <h1>Welcome to Mark's Kitchen</h1> + <nav class="float-left sidebar"> + <ul> + <li><a href="bread" class="btn btn-primary">Bread</a></li> + <li><a href="essay" class="btn btn-primary">Essays</a></li> + </ul> + </nav> + + <div> + <div class="card item"> + <div class="card-body"> + <p class="card-text"> + Come check out my gallery of homemade bread, featuring mainly artisan sourdough. + </p> + </div> + </div> + </div> + </body> +</html> diff --git a/src/index.js b/src/index.js new file mode 100644 index 0000000..767acb5 --- /dev/null +++ b/src/index.js @@ -0,0 +1,4 @@ +const server = require('./server'); +server.setUpRoutes(); +server.listen(); + diff --git a/src/photo/ban1.jpg b/src/photo/ban1.jpg Binary files differnew file mode 100644 index 0000000..0330443 --- /dev/null +++ b/src/photo/ban1.jpg diff --git a/src/photo/ban2.jpg b/src/photo/ban2.jpg Binary files differnew file mode 100644 index 0000000..f868504 --- /dev/null +++ b/src/photo/ban2.jpg diff --git a/src/photo/cider.jpg b/src/photo/cider.jpg Binary files differnew file mode 100644 index 0000000..176a094 --- /dev/null +++ b/src/photo/cider.jpg diff --git a/src/photo/first-1.jpg b/src/photo/first-1.jpg Binary files differnew file mode 100644 index 0000000..664acd7 --- /dev/null +++ b/src/photo/first-1.jpg diff --git a/src/photo/first-2.jpg b/src/photo/first-2.jpg Binary files differnew file mode 100644 index 0000000..11f2ab7 --- /dev/null +++ b/src/photo/first-2.jpg diff --git a/src/photo/flat1.jpg b/src/photo/flat1.jpg Binary files differnew file mode 100644 index 0000000..ff6df1c --- /dev/null +++ b/src/photo/flat1.jpg diff --git a/src/photo/flat2.jpg b/src/photo/flat2.jpg Binary files differnew file mode 100644 index 0000000..d07f638 --- /dev/null +++ b/src/photo/flat2.jpg diff --git a/src/photo/nyt1.jpg b/src/photo/nyt1.jpg Binary files differnew file mode 100644 index 0000000..a31e79e --- /dev/null +++ b/src/photo/nyt1.jpg diff --git a/src/photo/nyt2.jpg b/src/photo/nyt2.jpg Binary files differnew file mode 100644 index 0000000..5c955da --- /dev/null +++ b/src/photo/nyt2.jpg diff --git a/src/photo/wheat.jpg b/src/photo/wheat.jpg Binary files differnew file mode 100644 index 0000000..b039eb6 --- /dev/null +++ b/src/photo/wheat.jpg diff --git a/src/photo/white-1.jpg b/src/photo/white-1.jpg Binary files differnew file mode 100644 index 0000000..a58d50b --- /dev/null +++ b/src/photo/white-1.jpg diff --git a/src/photo/white-2.jpg b/src/photo/white-2.jpg Binary files differnew file mode 100644 index 0000000..87b8343 --- /dev/null +++ b/src/photo/white-2.jpg diff --git a/src/server.js b/src/server.js new file mode 100644 index 0000000..e2cfb20 --- /dev/null +++ b/src/server.js @@ -0,0 +1,33 @@ +const express = require('express'); + +const port = 80; + +const server = express(); + +function listen(){ + server.listen(port, () => console.info(`Listening on port ${port}!`)); +} + +function setUpRoutes(){ + server.get('/', (req, res) => res.sendFile(__dirname + "/html/index.html")) + server.get('/bread', (req, res) => res.sendFile(__dirname + "/html/bread.html")); + server.get('/essay', (req, res) => res.sendFile(__dirname + "/html/essay.html")); + + + server.get('/css/:id', (req, res) => { + res.sendFile(__dirname + "/css/"+req.params.id); + }); + server.get('/photo/:id', (req, res) => { + res.sendFile(__dirname + "/photo/"+req.params.id); + }); + server.get('/essay/:id', (req, res) => { + res.sendFile(__dirname + "/html/essay/"+req.params.id); + }); + +} + +module.exports = { + listen, + setUpRoutes +}; + |