From f75dfb5d736b644ad2649452c3056ba71be856b8 Mon Sep 17 00:00:00 2001 From: mattkae Date: Sun, 13 Nov 2022 19:51:56 -0500 Subject: The dumbest of blogging systems --- _posts/hello_world.html | 9 ++ _posts/processPosts.js | 121 +++++++++++++++++++++++++++ index.css | 4 +- index.html | 2 +- posts.css | 44 ++++++---- posts.html | 93 ++++++--------------- posts/hello_world.html | 41 ++++++++++ posts/linear_system_solver.html | 102 ----------------------- posts/linear_system_solver.html~ | 77 ------------------ posts/linear_system_solver.js | 172 --------------------------------------- posts/linear_system_solver.js~ | 106 ------------------------ resume.html | 24 +++--- 12 files changed, 238 insertions(+), 557 deletions(-) create mode 100644 _posts/hello_world.html create mode 100644 _posts/processPosts.js create mode 100644 posts/hello_world.html delete mode 100644 posts/linear_system_solver.html delete mode 100644 posts/linear_system_solver.html~ delete mode 100644 posts/linear_system_solver.js delete mode 100644 posts/linear_system_solver.js~ diff --git a/_posts/hello_world.html b/_posts/hello_world.html new file mode 100644 index 0000000..038f5db --- /dev/null +++ b/_posts/hello_world.html @@ -0,0 +1,9 @@ +

+ Hello, world! +

+

+ This is the first test of my simple, static blogging system. My goal is to avoid using anything too heavy and, instead, provide a simple script that will get run whenever I update a blog post. Heck, I could even set it up to a cronjob to refresh them everyday. But perhaps that is overkill for today 😆. I am satisfied with how it current works. +

+

+ Expect to see some updates on Greek philosophy, emacs, and Linux coming soon to a website near you! +

diff --git a/_posts/processPosts.js b/_posts/processPosts.js new file mode 100644 index 0000000..9db4103 --- /dev/null +++ b/_posts/processPosts.js @@ -0,0 +1,121 @@ + + +const fs = require('fs'); +const path = require('path'); + +const tags = [ + { + id: 'personal', + title: 'Personal 👨' + } +] + +const posts = [ + { + url: "_posts/hello_world.html", + title: "Hello, World!", + tags: [ "personal" ] + } +]; + +function createTag(tag) { + return ` + + `; +} + +function createPostServableFile(post) { + const dir = path.resolve(path.join(__dirname, '..', 'posts')); + + if (!fs.existsSync(dir)) { + fs.mkdirSync(dir); + } + + const baseFilePath = path.join(__dirname, '..', post.url); + const stats = fs.statSync(baseFilePath); + const content = fs.readFileSync(baseFilePath); + const fileName = post.url.substring(post.url.lastIndexOf('/')); + const filePath = path.join(dir, fileName); + fs.writeFileSync(filePath,` + + + + + + + + Matthew Kosarek + + + +
+

Matthew Kosarek

+ +
+ +
+

${post.title}

+

Created ${stats.birthtime.toLocaleString()}. Last updated: ${stats.mtime.toLocaleString()}

+ ${content} +
+ + + `) + return '/posts/' + fileName; +} + +function createPostLink(post) { + return ` +
  • ${post.title}
  • + `; +} + +const output = ` + + + + + + + + Matthew Kosarek + + + +
    +

    Matthew Kosarek

    + +
    + +
    +

    Tags

    +
    + ${tags.map(createTag)} +
    +
    +

    Posts

    + + + + +` + +fs.writeFileSync(path.join(__dirname, '..', 'posts.html'), output); diff --git a/index.css b/index.css index dd14a8f..e7428b5 100644 --- a/index.css +++ b/index.css @@ -1,7 +1,7 @@ body { width: 60vw; height: 100vh; - font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; + font-family: "Noto Sans", 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; font-size: 16px; background-color: transparent; color: black; @@ -102,7 +102,7 @@ section a:hover { .image_item > img { width: inherit; - border-radius: 3px; + border-radius: 3px; border: 2px solid rgba(0, 0, 0, 0.3); } diff --git a/index.html b/index.html index 50b8cbf..b82eea0 100644 --- a/index.html +++ b/index.html @@ -21,7 +21,7 @@
  • 🏡 Home
  • 📘 CV
  • 🏢 LinkedIn
  • -
  • 📝 Posts
  • +
  • 📝 Posts
  • diff --git a/posts.css b/posts.css index ef483fe..58204c3 100644 --- a/posts.css +++ b/posts.css @@ -1,28 +1,38 @@ -#post_section { - width: 50%; - display: flex; - flex-direction: column; - align-items: center; - color: white; +#tag_list { + width: 100%; + display: flex; + flex-direction: row; + align-items: center; + column-gap: 4px; +} + +#tag_list > button { + padding: 8px; + cursor: pointer; +} - font-family: Arial,Helvetica Neue,Helvetica,sans-serif !important; +#post_list { + display: flex; + flex-direction: column; } article { - width: 100%; - text-align: left; - padding-top: 1rem; + width: 100%; + text-align: left; + padding-top: 1rem; } article > h2 { - padding: 0; - margin: 0; + color: black; + padding: 0; + margin: 0; } article > h3 { - color: lightgray; - font-size: 0.8rem; - font-weight: normal; - padding: 0; - margin: 0; + margin: 0; + margin-top: 12px; + color: gray; + font-size: 12px; + font-weight: normal; + padding: 0; } diff --git a/posts.html b/posts.html index df70180..777073c 100644 --- a/posts.html +++ b/posts.html @@ -1,86 +1,43 @@ + - - + + - Matthew Kosarek - + Matthew Kosarek + -
    +

    Matthew Kosarek

    -
    - -
    +
    + +
    +

    Tags

    +
    + + + +
    +
    +

    Posts

    + - - - - - - diff --git a/posts/hello_world.html b/posts/hello_world.html new file mode 100644 index 0000000..27106e1 --- /dev/null +++ b/posts/hello_world.html @@ -0,0 +1,41 @@ + + + + + + + + + Matthew Kosarek + + + +
    +

    Matthew Kosarek

    + +
    + +
    +

    Hello, World!

    +

    Created 11/12/2022, 8:48:06 PM. Last updated: 11/13/2022, 7:51:38 PM

    +

    + Hello, world! +

    +

    + This is the first test of my simple, static blogging system. My goal is to avoid using anything too heavy and, instead, provide a simple script that will get run whenever I update a blog post. Heck, I could even set it up to a cronjob to refresh them everyday. But perhaps that is overkill for today 😆. I am satisfied with how it current works. +

    +

    + Expect to see some updates on Greek philosophy, emacs, and Linux coming soon to a website near you! +

    + +
    + + + \ No newline at end of file diff --git a/posts/linear_system_solver.html b/posts/linear_system_solver.html deleted file mode 100644 index a8b17e5..0000000 --- a/posts/linear_system_solver.html +++ /dev/null @@ -1,102 +0,0 @@ - -

    Linear Systems Solver

    -

    2021-08-01 by Matthew Kosarek

    -

    - I wanted to write a little algorithm to visually solve linear systems of equations for fun. I am only going to deal with 3x3 matrices for now, but I'll make it so that I can easily extend it to more matrices in the future if I think that would be cool. - -

    - -

    -
    - -
    - -
    -
    - -
    -
    - -
    - - -
    - - - - -

    diff --git a/posts/linear_system_solver.html~ b/posts/linear_system_solver.html~ deleted file mode 100644 index a280a8b..0000000 --- a/posts/linear_system_solver.html~ +++ /dev/null @@ -1,77 +0,0 @@ - -

    Linear Systems Solver

    -

    2021-08-01 by Matthew Kosarek

    -

    - I wanted to write a little algorithm to visually solve linear systems of equations for fun. I am only going to deal with 3x3 matrices for now, but I'll make it so that I can easily extend it to more matrices in the future if I think that would be cool. - -

    - -

    -
    - -
    - -
    -
    - -
    -
    - -
    - - -
    - - - - -

    diff --git a/posts/linear_system_solver.js b/posts/linear_system_solver.js deleted file mode 100644 index 9eb901f..0000000 --- a/posts/linear_system_solver.js +++ /dev/null @@ -1,172 +0,0 @@ -var $ = window.$, - rows = 3, - columns = 3, - currentLhs = [], // rows x columns matrix - currentRhs = []; // rows x 1 matrix - solutionContainer = $('#solution_container'); - -function main() { - $('#reset_button').on('click', onResetClicked); - $('#solve_button').on('click', onSolveClicked); - resetView(); -} - -function resetView() { - renderLHS(); - renderUnknowns(); - renderRHS(); - - currentLhs = []; - currentRhs = []; - for (var r = 0; r < rows; r++) { - for (var c = 0; c < columns; c++) { - currentLhs.push(0); - } - } - - for (var otherR = 0; otherR < rows; otherR++) { - currentRhs.push(0); - } - - solutionContainer.empty(); -} - -// Renders for the input container. -function renderLHS() { - var lhs = $('#matrix_lhs').empty(), - addCell = function(index) { - $('').type('number').val(0).on('change', function(event) { - currentLhs[index] = Number(event.target.value); - }).appendTo(lhs); - }; - - for (var r = 0; r < rows; r++) { - for (var c = 0; c < columns; c++) { - addCell((r * rows) + c); - } - } -} - -function renderUnknowns() { - var unknownsContainer = $('#unknown_variables').empty(); - - for (var r = 0; r < columns; r++) { - var cell = $('').disabled(true).val(String.fromCharCode('x'.charCodeAt(0) + r).toUpperCase()); - unknownsContainer.append(cell); - } -} - -function renderRHS() { - var rhs = $('#matrix_rhs').empty(), - addCell = function(index) { - $('').type('number').val(0).on('change', function(event) { - currentRhs[index] = Number(event.target.value); - }).appendTo(rhs); - }; - - for (var r = 0; r < rows; r++) { - addCell(r); - } -} - -// Renders for the augmented matrix container -function renderAugmentedMatrix(lhs, rhs) { - var container = $('
    ').addClass('augmented_matrix_container'), - lhsContainer = $('
    ').appendTo(container), - rhsContainer = $('
    ').appendTo(container), - addLhsCell = function(index) { - $('').type('number').val(lhs[index]).disabled(true).appendTo(lhsContainer); - }, - addRhsCell = function(index) { - $('').type('number').val(rhs[index]).disabled(true).appendTo(rhsContainer); - }; - - for (var r = 0; r < rows; r++) { - for (var c = 0; c < columns; c++) { - addLhsCell(r * rows + c); - } - } - - for (var otherR = 0; otherR < rows; otherR++) { - addRhsCell(otherR); - } - - return container; -} - -// Solver helper functions -function findLargestValue(c, rowStart) { - var largestValue = 0, - largestRow = -1; - for (var r = rowStart; r < rows; r++) { - var currValue = Math.abs(currentLhs[r * rows + c]); - if (currValue > largestValue) { - largestValue = currValue; - largestRow = r; - } - } - return { - row: largestRow, - value: largestValue - }; -} - -function swapRows(r1, r2) { - if (r1 === r2) { - return; - } - - for (var c = 0; c < columns; c++) { - var temp = currentLhs[r1 * row + c]; - currentLhs[r1 * rows + c] = currentLhs[r2 * row + c]; - currentLhs[r2 * rows + c] = temp; - } - - var rhsTmp = currentRhs[r1]; - currentRhs[r1] = currentRhs[r2]; - currentRhs[r2] = rhsTmp; -} - -function multiplyRow(r, scale) { - for (var c = 0; c < columns; c++) { - currentLhs[r * rows + c] *= scale; - } - - currentRhs[r] *= scale; -} - -function addRow(r, a) { - for (var c = 0; c < columns; c++) { - currentLhs[r * rows + c] += a; - } - - currentRhs[r] += a; -} - -// Callbacks for actions -function onResetClicked() { - resetView(); -} - -function onSolveClicked() { - var rowStart = 0; - for (var c = 0; c < columns; c++) { - var largestForColumn = findLargestValue(c, rowStart); - if (largestForColumn.row >= 0) { - swapRows(rowStart, largestForColumn.row); - multiplyRow(rowStart, 1.0 / largestForColumn.value); - - for (var r = 0; r < rows; r++) { - if (r === rowStart) continue; - - } - } - - rowStart++; - } - - solutionContainer.append(renderAugmentedMatrix(currentLhs, currentRhs)); - solutionContainer.append(renderAugmentedMatrix(currentLhs, currentRhs)); -} - -main(); diff --git a/posts/linear_system_solver.js~ b/posts/linear_system_solver.js~ deleted file mode 100644 index 33fc026..0000000 --- a/posts/linear_system_solver.js~ +++ /dev/null @@ -1,106 +0,0 @@ -var $ = window.$, - rows = 3, - columns = 3, - currentLhs = [], // rows x columns matrix - currentRhs = []; // rows x 1 matrix - solutionContainer = $('#solution_container'); - -function main() { - $('#reset_button').on('click', onResetClicked); - $('#solve_button').on('click', onSolveClicked); - resetView(); -} - -function resetView() { - renderLHS(); - renderUnknowns(); - renderRHS(); - - currentLhs = []; - currentRhs = []; - for (var r = 0; r < rows; r++) { - for (var c = 0; c < columns; c++) { - currentLhs.push(0); - } - } - - for (var otherR = 0; otherR < rows; otherR++) { - currentRhs.push(0); - } - - solutionContainer.empty(); -} - -// Renders for the input container. -function renderLHS() { - var lhs = $('#matrix_lhs').empty(), - addCell = function(index) { - $('').type('number').val(0).on('change', function(event) { - currentLhs[index] = Number(event.target.value); - }).appendTo(lhs); - }; - - for (var r = 0; r < rows; r++) { - for (var c = 0; c < columns; c++) { - addCell((r * rows) + c); - } - } -} - -function renderUnknowns() { - var unknownsContainer = $('#unknown_variables').empty(); - - for (var r = 0; r < columns; r++) { - var cell = $('').disabled(true).val(String.fromCharCode('x'.charCodeAt(0) + r).toUpperCase()); - unknownsContainer.append(cell); - } -} - -function renderRHS() { - var rhs = $('#matrix_rhs').empty(), - addCell = function(index) { - $('').type('number').val(0).on('change', function(event) { - currentRhs[index] = Number(event.target.value); - }).appendTo(rhs); - }; - - for (var r = 0; r < rows; r++) { - addCell(r); - } -} - -// Renders for the solution container -function renderAugmentedMatrix(lhs, rhs) { - var container = $('
    ').addClass('augmented_matrix_container'), - lhsContainer = $('
    ').appendTo(container), - rhsContainer = $('
    ').appendTo(container), - addLhsCell = function(index) { - $('').type('number').val(lhs[index]).disabled(true).appendTo(lhsContainer); - }, - addRhsCell = function(index) { - $('').type('number').val(rhs[index]).disabled(true).appendTo(rhsContainer); - }; - - for (var r = 0; r < rows; r++) { - for (var c = 0; c < columns; c++) { - addLhsCell(r * rows + c); - } - } - - for (var otherR = 0; otherR < rows; otherR++) { - addRhsCell(otherR); - } - - return container; -} - -// Callbacks for actions -function onResetClicked() { - resetView(); -} - -function onSolveClicked() { - solutionContainer.append(renderAugmentedMatrix(currentLhs, currentRhs)); -} - -main(); diff --git a/resume.html b/resume.html index e28129d..acac84c 100755 --- a/resume.html +++ b/resume.html @@ -1,14 +1,14 @@ - - - - + + + + - Matthew Kosarek - Resume - - + Matthew Kosarek - Resume + +
    @@ -17,8 +17,8 @@
    @@ -230,9 +230,9 @@

    Projects

    -- cgit v1.2.1