Skip to content

Commit ad9a7eb

Browse files
authored
Merge branch 'develop' into chore/single-script-for-new-users
2 parents 8997a3a + 94401a6 commit ad9a7eb

File tree

7 files changed

+88
-50
lines changed

7 files changed

+88
-50
lines changed
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
Tuesday, November 5th, 2024 • Niall Maher
2+
3+
# ⚡️ Better Image Loading + React Native's New Architecture
4+
5+
[Read online](https://www.codu.co/letters/is-your-domain-haunted)
6+
7+
My tip of the week is something I just learned about. A property called `fetchpriority` that drastically improved our Core Web Vitals. While most developers know about lazy loading, combining a few loading properties can make a big difference. You can further boost the priority of fetching an image using the `fetchpriority` property.
8+
9+
Here's what it looks like in action:​​​​​​​
10+
11+
```html
12+
rel="preload" as="image" href="hero.webp" fetchpriority="high" > src="hero.webp"
13+
loading="eager" fetchpriority="high" decoding="async" >
14+
```
15+
16+
Let's break down why this works so well:
17+
18+
- The `<link rel="preload">` tells browsers to start downloading the image immediately, even before they discover the tag while parsing HTML
19+
- `fetchpriority="high"` bumps the image to the top of the browser's resource queue, making it download before less critical resources
20+
- `loading="eager"` disables lazy loading for this specific image (crucial for above-the-fold content)
21+
- `decoding="async"` lets the browser optimize image decode timing without blocking other tasks
22+
23+
**Just remember:** use this pattern sparingly for critical above-the-fold images directly impacting LCP. For everything else, stick with regular lazy loading.
24+
25+
And a **Pro tip:** Combine this with the `srcset` attribute to handle responsive images, and you've got a bulletproof image-loading strategy. I wrote a little article on it this week. [Read it here](https://www.codu.co/articles/responsive-images-in-html-using-srcset-lyb6r6r0).
26+
27+
## 📚 This Week's Picks
28+
29+
**[Creating Custom VS Code Snippets for Faster Development](https://www.codu.co/articles/creating-custom-vs-code-snippets-for-faster-development-kgjv1ct)** (4 min)\
30+
Let's explore how to create custom snippets that will boost your productivity.
31+
32+
**[Introduction to C# and .NET](https://www.codu.co/articles/introduction-to-c-and-net-w0hc8gz3)** (4 min)\
33+
What is C#, and what is .NET? The first article in a series Adrián is writing to teach you C#.
34+
35+
**[Enhanced local IDE experience for AWS Lambda developers](https://aws.amazon.com/blogs/compute/introducing-an-enhanced-local-ide-experience-for-aws-lambda-developers/)** (8 min)\
36+
AWS Lambda is introducing an improved local IDE experience to simplify Lambda-based application development. The new features help developers to author, build, debug, test, and deploy Lambda applications more efficiently in their local IDE.
37+
38+
**[25 crazy software bugs explained](https://www.youtube.com/watch?v=Iq_r7IcNmUk)** (video)\
39+
Fireship dives into 25 crazy software bugs that changed the world.
40+
41+
**[React Native - New Architecture is here](https://reactnative.dev/blog/2024/10/23/the-new-architecture-is-here)** (22 min)\
42+
The 0.76 release blog post shared a list of significant changes in this version. It provides an overview of the New Architecture and how it shapes the future of React Native.
43+
44+
**[Lessons learned from a successful Rust rewrite](https://gaultier.github.io/blog/lessons_learned_from_a_successful_rust_rewrite.html)** (12 min)\
45+
A great deep dive into some important lessons when migrating a C++ codebase to Rust.
46+
47+
## 📖 Book of the Week
48+
49+
**[The Engineering Executive's Primer: Impactful Technical Leadership](https://amzn.to/4fj5bWf)**
50+
51+
This book is essential for technical leaders navigating the complexities of engineering management. Drawing from his extensive experience at companies like Stripe and Uber, Larson offers practical frameworks for scaling engineering organizations, developing talent, and driving technical strategy. What sets this book apart is its focused approach to the unique challenges faced by senior engineering leaders, from managing organizational design to balancing technical debt with business growth. Particularly valuable are the actionable insights on building effective engineering processes and fostering a culture of technical excellence.
52+
53+
Whether you're an engineering executive or aspiring to become one, this book provides the strategic toolkit needed for impactful technical leadership.
54+
55+
## 🛠️ Something Cool
56+
57+
**[Posthog](https://posthog.com/)**
58+
59+
This is not a sponsored post (I am mentioning it because I do see Posthog sponsors a lot of content). I've been using this tool again recently for a couple of projects, and it's just fantastic.
60+
61+
PostHog offers the full package---session recordings, feature flags, A/B testing, and product analytics. Whether you're running early experiments or want to systemize your product decisions, PostHog provides the data and tools needed to make data-driven choices. It has a very generous free tier (which I haven't been lucky enough to hit just yet with any of my side projects).
62+
63+
## 🔗 Quick Links
64+
65+
- [Codú TikTok](https://www.tiktok.com/@codu.co)
66+
- [Hacktoberfest GitHub Issues](https://github.com/codu-code/codu/issues)
67+
- [Our YouTube channel](https://www.youtube.com/@codu)
68+
- [Find us on Twitch](https://www.twitch.tv/codudotco)
69+
70+
**If you have any ideas or feedback, reply to this email.**
71+
72+
Thanks, and stay awesome,
73+
74+
Niall
75+
76+
Founder @ [Codú](https://www.codu.co/?ref=newsletter)

app/(editor)/create/[[...paramsArr]]/_client.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ const Create = ({ session }: { session: Session | null }) => {
557557
type="button"
558558
className="relative flex w-full focus:outline-none focus:ring-2 focus:ring-pink-300 focus:ring-offset-2 active:hover:bg-neutral-50 disabled:opacity-50"
559559
>
560-
<div className="input-base flex max-w-full flex-1 overflow-hidden border text-left">
560+
<div className="flex w-full max-w-full flex-1 overflow-hidden border px-2 py-2 text-left text-black shadow-sm ring-offset-1 focus:border-pink-500 focus:outline-none focus:ring-2 focus:ring-neutral-300 disabled:opacity-50 dark:border-white dark:bg-black dark:text-white sm:text-sm">
561561
{PREVIEW_URL}
562562
</div>
563563
<div className="absolute bottom-0 right-0 top-0 w-[120px] border border-neutral-300 bg-white px-4 py-2 font-medium text-neutral-600 shadow-sm">

components/ArticleMenu/ArticleMenu.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ const ArticleMenu = ({
150150
</div>
151151

152152
<button
153-
className="focus-style-rounded rounded-full p-1 hover:bg-neutral-300 dark:hover:bg-neutral-800 lg:mx-auto"
153+
className="rounded-full p-1 hover:bg-neutral-300 focus:outline-none focus:ring-white focus-visible:ring-2 focus-visible:ring-pink-600 focus-visible:ring-offset-pink-600 dark:hover:bg-neutral-800 lg:mx-auto"
154154
aria-label="bookmark-trigger"
155155
onClick={() => {
156156
if (!session) {

components/ArticlePreview/ArticlePreview.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ const ArticlePreview: NextPage<Props> = ({
155155
<div className="flex gap-x-2">
156156
{showBookmark && (
157157
<button
158-
className="focus-style-rounded rounded-full p-2 hover:bg-neutral-300 dark:hover:bg-neutral-800 lg:mx-auto"
158+
className="rounded-full p-2 hover:bg-neutral-300 focus:outline-none focus:ring-white focus-visible:ring-2 focus-visible:ring-pink-600 focus-visible:ring-offset-pink-600 dark:hover:bg-neutral-800 lg:mx-auto"
159159
onClick={() => {
160160
if (!session) {
161161
return signIn();

components/Footer/Footer.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,25 @@ const navigation = {
1919
social: [
2020
{
2121
name: "Twitter",
22+
customStyle: "hover:bg-twitter focus:bg-twitter",
2223
href: twitterUrl,
2324
icon: Twitter,
2425
},
2526
{
2627
name: "GitHub",
28+
customStyle: "hover:bg-github focus:bg-github",
2729
href: githubUrl,
2830
icon: Github,
2931
},
3032
{
3133
name: "Discord",
34+
customStyle: "hover:bg-discord focus:bg-discord",
3235
href: discordInviteUrl,
3336
icon: Discord,
3437
},
3538
{
3639
name: "Youtube",
40+
customStyle: "hover:bg-youtube focus:bg-youtube",
3741
href: youtubeUrl,
3842
icon: Youtube,
3943
},
@@ -77,7 +81,7 @@ const Footer = () => {
7781
href={item.href}
7882
target="_blank"
7983
rel="noopener noreferrer"
80-
className={`focus-style rounded-md p-1 transition-all duration-300 hover:scale-105 hover:text-white hover:brightness-110 focus:scale-105 focus:text-white focus:brightness-110 ${item.name.toLowerCase()}`}
84+
className={`focus-style rounded-md p-1 transition-all duration-300 hover:scale-105 hover:text-white hover:brightness-110 focus:scale-105 focus:text-white focus:brightness-110 ${item.customStyle.toLowerCase()}`}
8185
>
8286
<span className="sr-only">{item.name}</span>
8387
<item.icon className="h-6 w-6" aria-hidden="true" />

styles/globals.css

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
11
@tailwind base;
22

3-
:root {
4-
--discord-clr: linear-gradient(to bottom, #4b83fb, #734df8);
5-
--youtube-clr: linear-gradient(to top, #6d0202 22%, #c90000 61%);
6-
--github-clr: #f17f06;
7-
--twitter-clr: #282828;
8-
}
9-
103
body {
114
@apply bg-neutral-100 text-neutral-900 dark:bg-black dark:text-white;
125
}
@@ -45,10 +38,6 @@ body {
4538
}
4639
}
4740

48-
.input-base {
49-
@apply block w-full border px-2 py-2 text-black shadow-sm ring-offset-1 focus:border-pink-500 focus:outline-none focus:ring-2 focus:ring-neutral-300 disabled:opacity-50 dark:border-white dark:bg-black dark:text-white sm:text-sm;
50-
}
51-
5241
.nav-button {
5342
@apply focus-style rounded-md px-2 py-2 text-neutral-900 hover:bg-neutral-200 hover:text-black focus:text-neutral-900 dark:text-neutral-300 dark:hover:bg-neutral-900 dark:hover:text-white dark:focus:text-white;
5443
}
@@ -57,10 +46,6 @@ body {
5746
@apply rounded-md focus:outline-none focus:ring-white focus-visible:ring-2 focus-visible:ring-pink-600 focus-visible:ring-offset-pink-600;
5847
}
5948

60-
.focus-style-rounded {
61-
@apply rounded-full focus:outline-none focus:ring-white focus-visible:ring-2 focus-visible:ring-pink-600 focus-visible:ring-offset-pink-600;
62-
}
63-
6449
.primary-button {
6550
@apply inline-flex justify-center rounded-md bg-gradient-to-r from-orange-400 to-pink-600 px-4 py-2 font-medium text-white shadow-sm hover:from-orange-300 hover:to-pink-500 focus:outline-none focus:ring-2 focus:ring-pink-600 focus:ring-offset-2 focus-visible:ring-2 focus-visible:ring-pink-600 focus-visible:ring-offset-white disabled:border-neutral-300 disabled:from-neutral-500 disabled:to-neutral-700 disabled:text-neutral-300 disabled:hover:text-neutral-300;
6651
}
@@ -253,18 +238,6 @@ pre {
253238
scrollbar-width: none; /* Firefox */
254239
}
255240

256-
.rehype-code-title {
257-
@apply rounded-t-lg border border-b-0 border-neutral-200 bg-neutral-200 px-5 py-3 font-mono text-sm font-bold text-neutral-800 dark:border-neutral-700 dark:bg-neutral-800 dark:text-neutral-200;
258-
}
259-
260-
.rehype-code-title + pre {
261-
@apply mt-0 rounded-t-none;
262-
}
263-
264-
.highlight-line {
265-
@apply -mx-4 block border-l-4 border-blue-500 bg-neutral-100 px-4 dark:bg-neutral-800;
266-
}
267-
268241
/* Remove Safari input shadow on mobile */
269242
input[type="text"],
270243
input[type="email"] {
@@ -324,21 +297,6 @@ table div {
324297
animation: loader-dots3 0.6s infinite;
325298
}
326299

327-
/* Footer social hover effects */
328-
329-
.twitter {
330-
@apply hover:bg-twitter focus:bg-twitter;
331-
}
332-
.github {
333-
@apply hover:bg-github focus:bg-github;
334-
}
335-
.discord {
336-
@apply hover:bg-discord focus:bg-discord;
337-
}
338-
.youtube {
339-
@apply hover:bg-youtube focus:bg-youtube;
340-
}
341-
342300
/* end of plate editor styles */
343301

344302
@keyframes loader-dots1 {

tailwind.config.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ module.exports = {
88
extend: {
99
colors: {
1010
black: "#040404",
11-
twitter: "var(--twitter-clr)",
12-
github: "var(--github-clr)",
11+
twitter: "#282828",
12+
github: "#f17f06",
1313
},
1414
backgroundImage: {
15-
discord: "var(--discord-clr)",
16-
youtube: "var(--youtube-clr)",
15+
discord: "linear-gradient(to bottom, #4b83fb, #734df8)",
16+
youtube: "linear-gradient(to top, #6d0202 22%, #c90000 61%)",
1717
},
1818
},
1919
},

0 commit comments

Comments
 (0)