Skip to content

Instantly share code, notes, and snippets.

@npdtdev
npdtdev / +layout.svelte
Created September 15, 2023 15:46
Code for the blog post 'Self-hosting a font and using it with Sveltekit and Tailwindcss'
<script lang="ts">
import '../app.css';
import '@fontsource-variable/oxanium';
</script>
<slot />
@npdtdev
npdtdev / +page.svelte
Created August 6, 2023 12:03
Code for post How I use actions to achieve parallax images with Sveltekit
<img use:ukiyo={{ scale: 1.4, speed: 1.1 }} src={'https://source.unsplash.com/random/400x400'}/>
<img use:ukiyo={{}} src={'https://source.unsplash.com/random/600x400'} />
@npdtdev
npdtdev / index.html
Last active August 1, 2023 16:56
Code for blog post 'Using github gists to show code blocks'
<!DOCTYPE html>
<html>
<head>
<title>Title of the document</title>
</head>
<body>
<h1>My code is here</h1>
@npdtdev
npdtdev / global.css
Created August 1, 2023 12:43
Blog post code for adding a font to Tailwind CSS
@import url('https://fonts.googleapis.com/css2?family=Lato');
@npdtdev
npdtdev / +page.server.ts
Created August 1, 2023 11:18
Blog post code for server side pagination in Hygraph with Sveltekit and Houdini
import { PostsStore, type Posts$input } from "$houdini";
import { error } from "@sveltejs/kit";
import type { PageServerLoad } from "./$types";
const NUM_ITEMS = 1;
export const load: PageServerLoad = async (event) => {
let after = event.url.searchParams.get("after");
let before = event.url.searchParams.get("before");
if (after && before) {
before = null;