Skip to content

Instantly share code, notes, and snippets.

View mryechkin's full-sized avatar
💭
🇺🇦

Mykhaylo Ryechkin mryechkin

💭
🇺🇦
View GitHub Profile
@ryanto
ryanto / page.tsx
Created August 9, 2023 17:01
<Await> component
import { Markdown } from "@/app/components/markdown";
import { getComments, getPost } from "@/lib/db";
import { Suspense } from "react";
export default async function PostPage({
params,
}: {
params: { postId: string };
}) {
let post = await getPost(params.postId);
@jordienr
jordienr / tailwind.config.ts
Created July 15, 2023 09:10
Tailwind SVG Grid Background
// Remember to install mini-svg-data-uri
// Follow me on twitter for memes @jordienr
import { type Config } from "tailwindcss";
const {
default: flattenColorPalette,
} = require("tailwindcss/lib/util/flattenColorPalette");
const svgToDataUri = require("mini-svg-data-uri");
export default {
@gaearon
gaearon / 00-README-NEXT-SPA.md
Last active May 5, 2024 15:12
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.

@markerikson
markerikson / rtk-esm-ts-notes-2023-02-27.md
Last active September 3, 2023 00:33
RTK ESM/TS Config meeting notes - 2023-02-27/28

RTK ESM/TS Discussion

Attendees:

  • Nathan Bierema
  • Mateusz Burzynski
  • Mark Erikson

Notes

  • Mateusz: what do you want besides "ship widely compat code?" What preferences?
@jacob-ebey
jacob-ebey / deferred-overview.md
Last active September 11, 2023 09:10
Deferred Overview

Remix Deferred

Remix Deferred is currently implemented on top of React's Suspense model but is not limited to React. This will be a quick dive into how "promise over the wire" is accomplished.

SSR + Hydration

It isn't rocket science, but a quick recap of how frameworks such as react do SSR:

  1. Load data
  2. Render the app
@carc1n0gen
carc1n0gen / sarcasmify.py
Created April 29, 2022 19:24
Cli command to create sarcasm/mocking formatted texrt
#!/usr/bin/env python3
import sys
def sarcasmify(text):
new_text = ''
flip = True
for i in range(len(text)):
char = text[i]
if flip:
@mcmoe
mcmoe / Convert .mov or .MP4 to .gif.md
Last active April 8, 2024 09:15 — forked from SheldonWangRJT/Convert .mov or .MP4 to .gif.md
Convert Movie(.mov) file to Gif(.gif) file in one command line in Mac Terminal

This note is written by Sheldon. You can find me with #iOSBySheldon in Github, Youtube, Facebook, etc.

Need

Convert .mov/.MP4 to .gif

Reason

As a developer, I feel better to upload a short video when I create the pull request to show other viewers what I did in this PR. I tried .mov format directly got after finishing recording screen using Quicktime, however, gif offers preview in most web pages, and has smaller file size.

This is not limited to developer, anyone has this need can use this method to convert the files.

module.exports.addDefaultImport = function addImport(tree, mod, name) {
tree.children.unshift({
type: 'import',
value: `import _${name} from '${mod}'`,
});
return `_${name}`;
};
@joepie91
joepie91 / es-modules-are-terrible-actually.md
Last active April 26, 2024 13:33
ES Modules are terrible, actually

ES Modules are terrible, actually

This post was adapted from an earlier Twitter thread.

It's incredible how many collective developer hours have been wasted on pushing through the turd that is ES Modules (often mistakenly called "ES6 Modules"). Causing a big ecosystem divide and massive tooling support issues, for... well, no reason, really. There are no actual advantages to it. At all.

It looks shiny and new and some libraries use it in their documentation without any explanation, so people assume that it's the new thing that must be used. And then I end up having to explain to them why, unlike CommonJS, it doesn't actually work everywhere yet, and may never do so. For example, you can't import ESM modules from a CommonJS file! (Update: I've released a module that works around this issue.)

And then there's Rollup, which apparently requires ESM to be u