Skip to content

Instantly share code, notes, and snippets.

View mauriciomutte's full-sized avatar
👨‍💻
Coding

Maurício Mutte mauriciomutte

👨‍💻
Coding
View GitHub Profile
@gaearon
gaearon / 00-README-NEXT-SPA.md
Last active September 8, 2024 07:57
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.

@mauriciomutte
mauriciomutte / test-utils.tsx
Last active May 7, 2021 00:31
Testing-library + styled-components + Typescript
import { ReactElement } from 'react';
import { ThemeProvider } from 'styled-components';
import { render, RenderOptions } from '@testing-library/react';
import theme from 'styles/theme';
type CustomRenderProps = Omit<RenderOptions, 'queries'>;
const customRender = (ui: ReactElement, options: CustomRenderProps = {}) =>
render(<ThemeProvider theme={theme}>{ui}</ThemeProvider>, options);
@andrebrait
andrebrait / keychron_linux.md
Last active September 17, 2024 19:49
Keychron keyboards on Linux + Bluetooth fixes

Here is the best setup (I think so :D) for K-series Keychron keyboards on Linux.

Note: many newer Keychron keyboards use QMK as firmware and most tips here do not apply to them. Maybe the ones related to Bluetooth can be useful, but everything related to Apple's keyboard module (hid_apple) on Linux, won't work. As far as I know, all QMK-based boards use the hid_generic module instead. Examples of QMK-based boards are: Q, Q-Pro, V, K-Pro, etc.

Most of these commands have been tested on Ubuntu 20.04 and should also work on most Debian-based distributions. If a command happens not to work for you, take a look in the comment section.

Make Fn + F-keys work (NOT FOR QMK-BASED BOARDS)

Older Keychron keyboards (those not based on QMK) use the hid_apple driver on Linux, even in the Windows/Android mode, both in Bluetooth and Wired modes.