Skip to content

Instantly share code, notes, and snippets.

> import dynamic from "next/dynamic";
>
> import { createAdmin } from "../../../services/Cms/ClientAdminUi";
>
> const Blank = () => <></>;
>
> export const AdminPageContainer = dynamic(
> async () => {
> if (typeof window === "undefined") return Blank;
> await createAdmin();
@airtonix
airtonix / 01_README.md
Last active March 14, 2023 23:30
zinit with fzf-tab

zsh, zinit with fzf-tab

image

image

@airtonix
airtonix / 01_README.md
Last active October 9, 2023 21:58
NetlifyCMS Github Auth with NextJS and Vercel
  1. drop all the files included (replacing _ with /)

  2. create three apps in github oauth settings: Local DEV, Staging, Prod

    1. https://github.com/settings/applications/new
    2. fillout the details: don't worry too much right now you can change all these later
      • name: ☝️
      • home page: your url (http://localhost:3000, https://staging.your.doma.in, https://your.doma.in)
      • description: whatever... but the user will see this
      • authorization callback url: as above but with /api/callback : (http://localhost:3000/api/callback, https://staging.your.doma.in/api/callback, https://your.doma.in/api/callback)
  3. on the application detail page:

@airtonix
airtonix / Blanket.tsx
Last active February 4, 2023 04:50
modal scroll lock that doesn't cause layout reflow or jitter.
import type { PropsWithChildren } from "react";
import { useBlanket } from "./useBlanket";
export function Blanket({ children }: PropsWithChildren) {
const { isOpen, setIsOpen, zIndex, color } = useBlanket();
return (
<>
{isOpen && (
<div
import type { RefObject } from "react";
import { useCallback } from "react";
import { useState, useEffect } from "react";
type UseDragOptions = {
onPointerDown?: (event: PointerEvent) => void;
onPointerUp?: (event: PointerEvent) => void;
onPointerMove?: (event: PointerEvent) => void;
onDrag?: (event: DragEvent) => void;
};
@airtonix
airtonix / select-repos-to-delete.sh
Created October 30, 2022 06:05
Select and delete many repos from your account
#!/bin/sh
#
# Requires
# - [httpie](https://httpie.io/cli)
# - [jq](https://stedolan.github.io/jq/)
# - [fzf](https://github.com/junegunn/fzf)
# - GITHUB_TOKEN with `repos` and `delete repos` scope.
http https://api.github.com/user/repos "Authorization:token $GITHUB_TOKEN" per_page==100 type==owner \
| jq '.[] | select(.fork==true) | .full_name' \
@airtonix
airtonix / release.yaml
Last active October 30, 2022 05:05
Github Workflow to Publish OCI Docker Image
name: ci
# https://github.com/docker/build-push-action/blob/master/docs/advanced/tags-labels.md
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
schedule:
@airtonix
airtonix / storage.js
Created March 8, 2019 00:00
isomorphic-localstorage-proxy
import { createLocalStorage } from "localstorage-ponyfill";
export const isBrowser =
typeof window !== 'undefined' &&
typeof window.document !== 'undefined';
export const isNode =
typeof process !== 'undefined' &&
process.versions != null &&
process.versions.node != null;
...
functionGlobalContext: {
i2c:require('i2c'),
os:require('os'),
fs:require('fs'),
glob:require('glob'),
ua:require('universal-analytics')
// jfive:require("johnny-five"),
@airtonix
airtonix / index.js
Created September 27, 2018 08:02 — forked from zkat/index.js
npx is cool
#!/usr/bin/env node
console.log('yay gist')