From 275f58b1df0102d16b9cceb392d2560e3b32e46b Mon Sep 17 00:00:00 2001 From: Edward Shen Date: Sat, 28 Nov 2020 15:50:20 -0500 Subject: [PATCH] update .ignores, projects work --- .eslintignore | 7 ++--- .prettierignore | 5 ++-- gatsby-node.js | 7 +++-- src/components/item.module.css | 1 + src/components/item.tsx | 8 ++++-- src/projects/bunbun.mdx | 50 ++++++++++++++++++++++++++++++++++ src/projects/shlink.mdx | 6 ++-- src/templates/note.tsx | 3 +- src/templates/project.tsx | 31 +++++++++++++++++++++ src/templates/projects.tsx | 10 +++---- 10 files changed, 107 insertions(+), 21 deletions(-) create mode 100644 src/projects/bunbun.mdx create mode 100644 src/templates/project.tsx diff --git a/.eslintignore b/.eslintignore index f00c859..327237b 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,6 +1,5 @@ -# don't ever lint node_modules -node_modules -# don't lint build output (make sure it's set to your correct build folder name) -dist +node_modules/ +public/ +.cache/ # don't lint nyc coverage output coverage \ No newline at end of file diff --git a/.prettierignore b/.prettierignore index 58d06c3..605ae19 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,4 +1,5 @@ -.cache +.cache/ package.json package-lock.json -public +public/ +node_modules/ \ No newline at end of file diff --git a/gatsby-node.js b/gatsby-node.js index d9a9683..01c09eb 100644 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -92,7 +92,7 @@ exports.createPages = async ({ actions, graphql, reporter }) => { '**/src/notes/*', '/notes', './src/templates/notes.tsx', - './src/templates/note.tsx' + './src/templates/note.tsx', ); await generatePages( createPage, @@ -101,7 +101,7 @@ exports.createPages = async ({ actions, graphql, reporter }) => { '**/src/projects/*', '/projects', './src/templates/projects.tsx', - './src/templates/note.tsx' + './src/templates/project.tsx', ); }; @@ -114,7 +114,8 @@ exports.createSchemaCustomization = ({ actions: { createTypes } }) => { type CommonFrontmatter { hidden: Boolean, lang: String, - tags: [String] + tags: [String], + subtitle: String, } `); }; diff --git a/src/components/item.module.css b/src/components/item.module.css index 61c9b36..c33c0c2 100644 --- a/src/components/item.module.css +++ b/src/components/item.module.css @@ -1,6 +1,7 @@ .project-item { display: flex; align-items: baseline; + justify-content: space-between; } .project-title { diff --git a/src/components/item.tsx b/src/components/item.tsx index f048d9a..9727825 100644 --- a/src/components/item.tsx +++ b/src/components/item.tsx @@ -9,8 +9,10 @@ interface ItemProps { } export default (props: ItemProps): JSX.Element => ( - -

{props.title}

+
+ +

{props.title}

+

{props.subtitle}

- +
); diff --git a/src/projects/bunbun.mdx b/src/projects/bunbun.mdx new file mode 100644 index 0000000..c624cef --- /dev/null +++ b/src/projects/bunbun.mdx @@ -0,0 +1,50 @@ +--- +title: "Bunbun" +subtitle: "Cross-browser search commands" +path: "bunbun" +date: 2020-01-01 +lang: "rust" +tags: [] +--- + +[Bunbun][1] is a search delegation service and my first project in Rust. It's a +implementation of [bunny1][bunny1] that offers a simple config file as well as +an extensible plugin system. + +An interesting note about the project is that [I've submitted a patch][hotwatch] +to an library to fix a bug where the file descriptor for watching the config +file would get stale. + +For me, it solves a lot of problems I have, particularly in the sense that it +lets me write shortcuts that I know will always work, instead of relying on +browsers to remember for me. + +Yes, existing solutions exist, such as DuckDuckGo's [bang!][ddg-bangs] as well +as FireFox's shortcuts, but I believe this has a niche particularly for +self-hosted or enterprise environments. As it allows for plugins to run, it can +offer a uniform experience for employees or users to access common resources. + +Honestly, this idea didn't sell me at first, but after using a similar variant +at my past work, I was completely dependent on it in only 12 weeks. + +I've been living on this project for months now, so I can guarantee that it +works. From a privacy and security perspective, I find it to be satisfactory for +my needs: +1. It only logs to `stdout` with the option to completely disable logging. +2. It's built in Rust without any `unsafe` usage, which guarantees that my code +should be sound. +3. It uses `actix`, a well respected HTTP server library that is relatively +receptive of security concerns. +4. Its plugin system is as private and secure as the host it's running on, and +fails safe on improperly defined inputs. +5. It has meaningful tests! + +_Caveat emptor_[^1], of course. You should audit the code yourself, but I'm +happy with the work I've made (and always receptive of feedback). + +[1]: https://github.com/edward-shen/bunbun +[bunny1]: http://www.bunny1.org/ +[hotwatch]: https://github.com/francesca64/hotwatch/pull/4 +[ddg-bangs]: https://duckduckgo.com/bang + +[^1]: https://en.wikipedia.org/wiki/Caveat_emptor \ No newline at end of file diff --git a/src/projects/shlink.mdx b/src/projects/shlink.mdx index 0a677ea..75cd479 100644 --- a/src/projects/shlink.mdx +++ b/src/projects/shlink.mdx @@ -1,8 +1,10 @@ --- +title: "Shlink" +subtitle: "1-click link shortening" path: "shlink" date: 2020-01-01 -title: "Shlink" lang: "js" +tags: [] --- -Hello World +Shlink \ No newline at end of file diff --git a/src/templates/note.tsx b/src/templates/note.tsx index 37ae0fa..6b6b5e6 100644 --- a/src/templates/note.tsx +++ b/src/templates/note.tsx @@ -4,8 +4,7 @@ import { graphql } from 'gatsby'; import { MDXRenderer } from 'gatsby-plugin-mdx'; export default ({ data }) => { - const { frontmatter, body } = data.mdx; - + const { frontmatter, tableOfContents, body } = data.mdx; return ( <> diff --git a/src/templates/project.tsx b/src/templates/project.tsx new file mode 100644 index 0000000..8f8c60d --- /dev/null +++ b/src/templates/project.tsx @@ -0,0 +1,31 @@ +import React from 'react'; +import Navbar from '../components/navbar'; +import { graphql } from 'gatsby'; +import { MDXRenderer } from 'gatsby-plugin-mdx'; + +export default ({ data }) => { + const { frontmatter, body } = data.mdx; + return ( + <> + +
+

{frontmatter.title}

+
{frontmatter.subtitle}
+ {body} +
+ + ); +}; + +export const query = graphql` + query ProjectsItemQuery($id: String!) { + mdx(id: { eq: $id }) { + frontmatter { + title + subtitle + } + tableOfContents + body + } + } +`; diff --git a/src/templates/projects.tsx b/src/templates/projects.tsx index f2c0428..ccefccb 100644 --- a/src/templates/projects.tsx +++ b/src/templates/projects.tsx @@ -11,14 +11,14 @@ export default ({ data, pageContext }): JSX.Element => { return ( <> - {posts.map(({ node }) => { - const frontmatter = node.frontmatter; + {posts.map(({ node: { id, frontmatter } }) => { return ( + /> ); })}