Skip to content

Commit

Permalink
Update blurb, code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
rosslh committed Oct 5, 2024
1 parent be52320 commit 982c08b
Show file tree
Hide file tree
Showing 11 changed files with 44 additions and 68 deletions.
1 change: 0 additions & 1 deletion content/doctalk.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ endDate: 2022-09-16
thumbnail: doctalk-thumb
excerpt: Built products that improved collaboration and communication for doctors, medical residents, and pharmaceutical companies.
tags: [react, redux, django, postgresql]
# heroku
eventType: work
website: https://doctalk.com
---
1 change: 0 additions & 1 deletion content/folda.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ date: 2019-09-01
thumbnail: folda
excerpt: An online system for selling tickets and getting audience metrics for foldA, a digital performance festival in Kingston, Ontario. Created as my Queen's Computing capstone project.
tags: [svelte, flask, postgresql]
# heroku
repository: https://github.com/foldA-Kingston/foldA-Box-Office-System
website: https://folda.netlify.com
isHidden: true
Expand Down
2 changes: 1 addition & 1 deletion content/mandelbrot.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ tags: [python]
isHidden: true
---

The Mandelbrot Set is the set of complex numbers that stays bounded when iterated on the function, <code>f(z) = z<sup>2</sup> + c</code>. A famous example of a fractal in mathematics, the Mandelbrot Set has infinite complexity which makes exploring it quite interesting. In Python, using the UI and graphics libraries TKinter and Pillow, I created an interactive Mandelbrot Set visualizer that lets you zoom into parts of the fractal.
The Mandelbrot Set is the set of complex numbers that stays bounded when iterated on the function, `f(z) = z² + c`. A famous example of a fractal in mathematics, the Mandelbrot Set has infinite complexity which makes exploring it quite interesting. In Python, using the UI and graphics libraries TKinter and Pillow, I created an interactive Mandelbrot Set visualizer that lets you zoom into parts of the fractal.

One challenge with the Mandelbrot set is that it is quite computationally intensive to visualize. For each pixel in the visualization, those coordinates need to be iterated on the before-mentioned formula. In order to speed up the visualization, this project uses multiprocessing to split up the work load across all available CPU cores on the computer. Through this project I gained experience in software graphics and designing user interfaces.
1 change: 0 additions & 1 deletion content/webofdevs.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@ thumbnail: webofdevs-thumb
thumbnailBorder: true
excerpt: A community of developers with amazing webpages. You can browse personal sites, save your favorites, and share your own.
tags: [typescript, svelte, nestjs, postgresql]
# vercel, heroku
---
1 change: 1 addition & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 12 additions & 2 deletions src/lib/components/Tag.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
export let needsOutlineOnDarkBg = false;
import { tagLabels } from "$lib/tags";
import { isPageBackgroundDark, remsToPixels } from "$lib/functions";
import { prefersColorSchemeDark, remsToPixels } from "$lib/functions";
import { themeStore } from "$lib/stores";
import { browser } from "$app/environment";
import { SiteTheme } from "$lib/types";
$: tagString = tagLabels[tagId] ?? tagId;
Expand All @@ -39,13 +40,22 @@
const getHexOpacity = (floatPercentage: number): string =>
Math.round(255 * floatPercentage).toString(16);
const isPageBackgroundDark = (currentTheme: SiteTheme) => {
const darkThemes = [SiteTheme.Dark, SiteTheme.Cyberpunk, SiteTheme.Black];
return (
darkThemes.includes(currentTheme) ||
(currentTheme === SiteTheme.Auto && prefersColorSchemeDark(browser))
);
};
$: dividerColor = active
? `#${foreground}${getHexOpacity(0.35)}`
: "transparent";
const hasOutline =
(needsOutlineOnDarkBg || needsOutlineOnLightBg) &&
isPageBackgroundDark(browser, $themeStore)
isPageBackgroundDark($themeStore)
? needsOutlineOnDarkBg
: needsOutlineOnLightBg;
</script>
Expand Down
38 changes: 0 additions & 38 deletions src/lib/functions.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import getSlug from "slugify";
import { SiteTheme } from "./types";

export const slugify = (stringToSlugify: string): string =>
getSlug(stringToSlugify, {
Expand All @@ -13,42 +12,5 @@ export const remsToPixels = (rems: number): number => Math.round(rems * 16);
export const prefersColorSchemeDark = (browser: boolean): boolean =>
browser && window.matchMedia("(prefers-color-scheme: dark)").matches;

export const isPageBackgroundDark = (
browser: boolean,
currentTheme: SiteTheme,
) => {
const darkThemes = [SiteTheme.Dark, SiteTheme.Cyberpunk, SiteTheme.Black];

return (
darkThemes.includes(currentTheme) ||
(currentTheme === SiteTheme.Auto && prefersColorSchemeDark(browser))
);
};

export const formatPostTitle = (title: string): string =>
title.replaceAll(/\s[–—-]\s/g, " – ");

export const truncateBySentence = (text: string, maxLength: number): string => {
const sentences: string[] = text
.split(".")
.filter((sentence) => sentence.trim())
.map((sentence) => `${sentence.trim()}.`);

if (!sentences[0]) {
return text;
}

let truncated: string = sentences[0];

for (let index = 1; index < sentences.length; index += 1) {
const sentence = sentences[index];
if (truncated.length + (sentence?.length ?? 0) > maxLength) {
break;
}
truncated += ` ${sentence}`;
}

const firstSentence = `${text.split(".")[0]}.`;

return truncated || firstSentence;
};
20 changes: 1 addition & 19 deletions src/lib/occasions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,6 @@ const getCanadianThanksgivingDate = (): {
return { startDay, startMonth, durationDays };
};

const getAmericanThanksgivingDate = (): {
startDay: number;
startMonth: number;
durationDays: number;
} => {
const startMonth = 11;
const startDay = getNthDayOfWeekInMonth(startMonth, 4, 4);
const durationDays = 1;

return { startDay, startMonth, durationDays };
};

const currentYear = new Date().getFullYear();
const newYear = addMonths(new Date(), 1).getFullYear();

Expand Down Expand Up @@ -123,7 +111,7 @@ export const occasions = [
imageName: "reconciliation",
blurbMaxWidth: "16rem",
learnMoreUrl:
"https://www.rcaanc-cirnac.gc.ca/eng/1631130192216/1631130220404",
"https://www.canada.ca/en/canadian-heritage/campaigns/national-day-truth-reconciliation.html",
},
{
name: "Halloween",
Expand Down Expand Up @@ -158,12 +146,6 @@ export const occasions = [
imageName: "trans",
learnMoreUrl: "https://www.glaad.org/transweek",
},
{
name: "American Thanksgiving",
blurb: "Happy Thanksgiving to all my American friends!",
imageName: "thanksgiving",
...getAmericanThanksgivingDate(),
},
{
name: `Holidays ${currentYear}`,
blurb: "I hope you have a wonderful holiday season!",
Expand Down
7 changes: 4 additions & 3 deletions src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,10 @@
<p>
{#key $themeStore}
<Balancer>
I develop software and I'm always on the lookout for cool new
technologies. I like to spend my time reading, working on side
projects, and exploring the great city of Toronto.
As a seasoned full-stack engineer with a passion for front-end, I
specialize in building delightful user experiences that drive results.
My expertise in TypeScript and a focus on code quality enable me to
create seamless applications that are robust and maintainable.
</Balancer>
{/key}
</p>
Expand Down
26 changes: 25 additions & 1 deletion src/routes/item/[slug]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import { MetaTags } from "svelte-meta-tags";
import { onMount, tick } from "svelte";
import { tagLabels } from "$lib/tags";
import { truncateBySentence } from "$lib/functions";
export let data: { post: PostItemPage; tagColors: TagColors };
const { post, tagColors } = data;
Expand All @@ -24,6 +23,31 @@
const capitalize = (text: string): string =>
text.replaceAll(/\b\w/g, (m) => m.toUpperCase());
const truncateBySentence = (text: string, maxLength: number): string => {
const sentences: string[] = text
.split(".")
.filter((sentence) => sentence.trim())
.map((sentence) => `${sentence.trim()}.`);
if (!sentences[0]) {
return text;
}
let truncated: string = sentences[0];
for (let index = 1; index < sentences.length; index += 1) {
const sentence = sentences[index];
if (truncated.length + (sentence?.length ?? 0) > maxLength) {
break;
}
truncated += ` ${sentence}`;
}
const firstSentence = `${text.split(".")[0]}.`;
return truncated || firstSentence;
};
const meta = {
title: post.title.length < 50 ? `${post.title} | Ross Hill` : post.title,
description: truncateBySentence(post.excerpt, 155) ?? post.title,
Expand Down
1 change: 0 additions & 1 deletion tests/specs/sidebar.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ const occasions = {
"Canadian Thanksgiving": ["2023-10-08", "2023-10-09", "2023-10-10"],
"Remembrance Day": ["2023-11-11"],
"Transgender Awareness Week": ["2023-11-13", "2023-11-16", "2023-11-19"],
"American Thanksgiving": ["2023-11-23"],
"Holidays 2023": ["2023-12-10", "2023-12-20", "2023-12-28"],
"New Year's Eve": ["2023-12-31"],
};
Expand Down

0 comments on commit 982c08b

Please sign in to comment.