-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
299 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"_variables": { | ||
"lastUpdateCheck": 1736791334401 | ||
"lastUpdateCheck": 1737940308832 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: Update Submodules | ||
|
||
on: | ||
schedule: | ||
- cron: '0 0 */3 * *' # every 3 days at midnight | ||
workflow_dispatch: | ||
|
||
jobs: | ||
update: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
token: ${{ secrets.PAT }} | ||
|
||
- name: Update submodules | ||
run: | | ||
git config --global user.name 'GitHub Action' | ||
git config --global user.email '[email protected]' | ||
git submodule update --remote --recursive | ||
git add . | ||
git diff --cached --quiet || git commit -m "action: update submodules" | ||
git push |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule resources
updated
15 files
+0 −33 | .github/PULL_REQUEST_TEMPLATE/pull_request_template.md | |
+4 −0 | CONTRIBUTING.md | |
+1 −1 | LICENSE | |
+17 −113 | README.md | |
+8 −0 | lists/algorithms.md | |
+14 −0 | lists/databases-and-filesystems.md | |
+14 −0 | lists/essentials.md | |
+11 −0 | lists/for-fun.md | |
+10 −0 | lists/math.md | |
+73 −0 | lists/need-sorting.md | |
+16 −0 | lists/performance.md | |
+11 −0 | lists/productivity.md | |
+36 −0 | lists/programming-languages.md | |
+16 −0 | lists/unix.md | |
+7 −0 | lists/web-development.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
--- | ||
import { getCollection } from "astro:content"; | ||
import Layout from "../../layouts/Layout.astro"; | ||
export async function getStaticPaths() { | ||
const resources = await getCollection("resources"); | ||
return resources.map((x) => ({ | ||
params: { | ||
slug: x.id.replace(/^lists\//, '').replace(/\.md$/, '') | ||
}, | ||
props: { entry: x }, | ||
})); | ||
} | ||
const { entry } = Astro.props; | ||
const { Content } = await entry.render(); | ||
--- | ||
|
||
<Layout> | ||
<div class="inline w-full overflow-hidden text-slate-800"> | ||
<div class="mx-auto w-3/4"> | ||
<div class="text-base/6 font-sans prose prose-lg prose-zinc"> | ||
<Content /> | ||
</div> | ||
</div> | ||
</div> | ||
</Layout> | ||
|
||
<script> | ||
document.addEventListener('click', (e) => { | ||
const target = e.target as HTMLElement; | ||
if (target.tagName === 'A') { | ||
const href = target.getAttribute('href'); | ||
if (href?.includes('README.md')) { | ||
e.preventDefault(); | ||
window.location.href = '/resources'; | ||
} | ||
} | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import fs from 'fs'; | ||
import path from 'path'; | ||
|
||
function getAllMarkdownFiles(dirPath: string, arrayOfFiles: string[] = []): string[] { | ||
const files = fs.readdirSync(dirPath); | ||
|
||
files.forEach((file) => { | ||
const filePath = path.join(dirPath, file); | ||
if (fs.statSync(filePath).isDirectory()) { | ||
arrayOfFiles = getAllMarkdownFiles(filePath, arrayOfFiles); | ||
} else if (path.extname(file) === '.md') { | ||
const relativePath = path.relative(path.join(process.cwd(), 'src/content/resources'), filePath); | ||
arrayOfFiles.push(relativePath); | ||
} | ||
}); | ||
|
||
return arrayOfFiles; | ||
} | ||
|
||
export function generateResourceRedirects() { | ||
const redirects: Record<string, string> = { | ||
// existing static redirects | ||
"/hours.html": "/hours", | ||
"/blog.html": "/blog", | ||
"/coords": "/about", | ||
"/2022/02/25/incorrect-reification.html": "/blog/incorrect-reification/", | ||
"/2022/02/02/learning-to-code-with-projects.html": "/blog/learning-to-code-with-projects/", | ||
"/2022/02/09/a-cautionary-tale-of-amazon-web-service-classes.html": "/blog/a-cautionary-tale-of-amazon-web-service-classes/", | ||
"/2022/03/17/exploiting-github-actions.html": "/blog/exploiting-github-actions/", | ||
"/2022/04/03/why-i-use-firefox.html": "/blog/why-i-use-firefox/", | ||
"/2022/04/16/Game-Design-and-Education.html": "/blog/game-design-and-education/", | ||
"/2022/04/7/Artificial-Consciousness-and-Phenomenology.html": "/blog/artificial-consciousness-and-phenomenology/", | ||
"/2022/05/12/Using-GPT3-To-Write-A-Blog-Post.html": "/blog/using-gpt3-to-write-a-blog-post/", | ||
}; | ||
|
||
// get all markdown files from the resources dir & add redirects to each | ||
const contentDir = path.join(process.cwd(), 'src/content/resources'); | ||
const markdownFiles = getAllMarkdownFiles(contentDir); | ||
|
||
markdownFiles.forEach((file) => { | ||
const normalizedPath = file.split(path.sep).join('/'); | ||
redirects[`/${normalizedPath}`] = `/${normalizedPath.replace(/\.md$/, '')}`; | ||
}); | ||
|
||
return redirects; | ||
} |