Skip to content

Instantly share code, notes, and snippets.

View franky47's full-sized avatar

François Best franky47

View GitHub Profile
@franky47
franky47 / sysex-queue.ino
Last active August 2, 2023 06:32
Message queue to print incoming SysEx
View sysex-queue.ino
#include <MIDI.h>
#include <string.h>
MIDI_CREATE_DEFAULT_INSTANCE();
template<unsigned Size, typename DataType>
struct MessageQueue {
static constexpr unsigned sMask = Size - 1;
inline MessageQueue<Size, DataType>()
@franky47
franky47 / interesting-web-services.md
Last active June 1, 2023 16:06
Interesting web services
View interesting-web-services.md

Interesting web services

A semi-curated list of SaaS, platforms and web-based tools for software development.

Analytics

  • Chiffre - End-to-end encrypted analytics (shameless plug)
  • Matomo - Self-hostable alternative to Google Analytics

Cartography

@franky47
franky47 / stripe-webhooks.ts
Created December 21, 2021 09:44
Strongly-typed webhook handlers for Stripe (Node.js)
View stripe-webhooks.ts
import type { Stripe } from 'stripe'
export type StripeWebhookEventTypes =
Stripe.WebhookEndpointCreateParams.EnabledEvent
export type StripeWebhookEvent<
EventType extends StripeWebhookEventTypes,
Payload
> = {
eventType: EventType
@franky47
franky47 / .zshrc
Last active November 15, 2022 20:34
View .zshrc
# The following lines were added by compinstall
# zstyle ':completion:*:descriptions' format '%B%d%b'
# zstyle ':completion:*:messages' format '%d'
# zstyle ':completion:*:warnings' format 'No matches for: %d'
# zstyle ':completion:*' group-name ''
# zstyle ':completion:*' group-name ''
# zstyle ':completion:*' ignore-parents parent pwd .. directory
# zstyle ':completion:*' insert-unambiguous true
# zstyle ':completion:*' list-colors ''
@franky47
franky47 / settings.json
Created February 17, 2022 01:15
VSCode experimental file nesting configuration
View settings.json
{
"explorer.experimental.fileNesting.enabled": true,
"explorer.experimental.fileNesting.patterns": {
"*.ts": "$(capture).js, $(capture).d.ts, $(capture).test.ts",
"*.js": "$(capture).js.map, $(capture).min.js, $(capture).d.ts, $(capture).test.js",
"*.jsx": "$(capture).js",
"*.tsx": "$(capture).ts, $(capture).*.ts, $(capture).*.tsx",
"tsconfig.json": "tsconfig.*.json",
"docker-compose.yml": "docker-compose.*.yml",
".env": ".env.*",
@franky47
franky47 / reduceTree.ts
Created November 29, 2021 15:24
Recursion-free, depth-first object traversal à la `reduce`.
View reduceTree.ts
/**
* Traverse a JSON object depth-first, in a `reduce` manner.
*
* License: MIT © 2021 François Best (https://francoisbest.com)
*
* @param input The root node to traverse
* @param callback A function to call on each visited node
* @param initialState Think of this as the last argument of `reduce`
*/
export function reduceTree<State>(
@franky47
franky47 / chakra-colors.json
Created April 21, 2021 16:30
ChakraUI Palette Mod - Increased Saturation & Luminosity
View chakra-colors.json
{
"colors": {
"green": {
"50": "#ECF8EF",
"100": "#CBECD2",
"200": "#A9DFB6",
"300": "#88D399",
"400": "#66C77C",
"500": "#45BA60",
"600": "#37954D",
@franky47
franky47 / list-tweet-urls.js
Created March 19, 2021 10:46
List all the Tweet URLs on the page
View list-tweet-urls.js
Array.from(
new Set(
// List all links on the page
Array.from(document.getElementsByTagName('a'))
.filter(a =>
// Only keep status URLs
a.href.match(/^https:\/\/twitter\.com\/(\w+)\/status\/(\d+)$/)
)
.map(a => a.href) // Keep only the link URL
) // new Set: remove duplicates
@franky47
franky47 / EmojiFavicon.tsx
Created February 16, 2021 14:16
Emoji Favicon with badge
View EmojiFavicon.tsx
import React from 'react'
export interface EmojiFaviconProps {
emoji: string
badgeEmoji?: string
}
export const EmojiFavicon: React.FC<EmojiFaviconProps> = ({ emoji, badgeEmoji }) => {
const inlineSvg = React.useMemo(() => {
return `
@franky47
franky47 / usePasteAnywhere.ts
Created February 10, 2021 07:17
usePasteAnywhere
View usePasteAnywhere.ts
import * as React from 'react'
export function usePasteAnywhere(callback: (text: string) => void) {
React.useEffect(() => {
const body = document.getElementsByTagName('body')[0]
const onPaste = (e: ClipboardEvent) => {
const data = e.clipboardData?.getData('text/plain')
if (data) {
callback(data)
}