Skip to content

Instantly share code, notes, and snippets.

@gaearon
gaearon / 00-README-NEXT-SPA.md
Last active April 25, 2025 13:14
Next.js SPA example with dynamic client-only routing and static hosting

Next.js client-only SPA example

Made this example to show how to use Next.js router for a 100% SPA (no JS server) app.

You use Next.js router like normally, but don't define getStaticProps and such. Instead you do client-only fetching with swr, react-query, or similar methods.

You can generate HTML fallback for the page if there's something meaningful to show before you "know" the params. (Remember, HTML is static, so it can't respond to dynamic query. But it can be different per route.)

Don't like Next? Here's how to do the same in Gatsby.

@ducan-ne
ducan-ne / Caddyfile
Last active December 24, 2023 17:45
Dockerfile "zero-config" over 35 frameworks. "One Dockerfile to rule them all"
# The Caddyfile is an easy way to configure your Caddy web server.
#
# Unless the file starts with a global options block, the first
# uncommented line is always the address of your site.
#
# To use your own domain name (with automatic HTTPS), first make
# sure your domain's A/AAAA DNS records are properly pointed to
# this machine's public IP, then replace ":80" below with your
# domain name.
@tuanchauict
tuanchauict / README.md
Last active May 11, 2024 23:08
Attach a stopwatch to Leetcode

This script attaches a stopwatch into the toolbar of Leetcode's problem page.

image

The feature is simple:

  • Start/Stop the stopwatch
  • Auto start after 2 mins remaining on the problem
  • Restore unstopped stopwatch for the next visit on the problem

Use this script with any browser extension allowing attaching JS to the page. (I use User JavaScript and CSS)

import React, { useCallback, useEffect, useRef, useState } from "react";
import { Platform, StyleSheet, TouchableOpacity, View } from "react-native";
import Svg, { Circle, Line, Path, Rect } from "react-native-svg";
import Animated, {
runOnJS,
useAnimatedGestureHandler,
useAnimatedProps,
useAnimatedStyle,
useDerivedValue,
useSharedValue,
@markerikson
markerikson / AppErrorFallback.tsx
Created July 1, 2021 13:43
Next.js ErrorBoundary example
import React from 'react';
import Jumbotron from 'react-bootstrap/Jumbotron';
import Alert from 'react-bootstrap/Alert';
import Button from 'react-bootstrap/Button';
import { FallbackProps } from 'react-error-boundary';
interface AEFProps extends FallbackProps {
@sreeragh-ar
sreeragh-ar / python_quick_tips.ipynb
Created June 23, 2021 14:07
Python_quick_tips.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# Source: https://gist.github.com/48f44d3974db698d3127f52b6e7cd0d3
###########################################################
# Automation of Everything #
# How To Combine Argo Events, Workflows, CD, and Rollouts #
# https://youtu.be/XNXJtxkUKeY #
###########################################################
# Requirements:
# - k8s v1.19+ cluster with nginx Ingress
# Source: https://gist.github.com/764b402c8979678dfde01fd8f63c22e2
###########################################################
# Kustomize vs Helm #
# The Fight Between Templating and Patching in Kubernetes #
# https://youtu.be/ZMFYSm0ldQ0 #
###########################################################
# Links to referenced videos:
# - https://youtu.be/sUPkGChvD54
@buffalom
buffalom / vuejs-conference-amsterdam-2020.md
Last active July 4, 2022 15:39
My Takeaways from the Vue.js Conference 2020 in Amsterdam

Vue.js Conference Amsterdam 2020

https://vuejs.amsterdam/


  • Talks
    • ⭐️State of Vuenion 2020
    • Scalable Vue Graphics
  • Vue Test Utils
@rculp
rculp / vuejs.amsterdam.2020.slides.md
Last active August 5, 2021 16:33
A collection of talks/slides (where available) from #vuejsamsterdam 2020

Day 1

Time Speaker Title Description
9:00 Evan You, Creator of Vue.js State of the Vuenion 2020 The growth of Vue continues and we are almost ready for Vue 3. As ever Evan You will deliver the State of Vuenion 2020, if we are lucky maybe we see some Typescript code from him ;)
 Dima Vishnevetsky Scalable Vue Graphics for the Modern Web 
 Jessica Sachs, Maintainer of @vue/test-utils and Tech Lead at Intent The Future of Vue's Test Utils With an expanded Vue Test Utils team and with Vue 3 on the horizon, we’ll talk about our plans for 2020. What’s coming in v1?
11:00 Gregg Pollack, Teaching developers Vue.js at VueMastery Introduction into the Composition API Gregg Pollack i