Skip to content

Instantly share code, notes, and snippets.

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')
const express = require('express');
const serveStatic = require('serve-static');
const STATIC_ROOT = '/static/';
const app = express();
Random ports used by webpack-serve despite ports configured.
repo: https://github.com/airtonix/netlify-cms-widget-relations
It's also caused by the fact that you might have `onchange` wrapping your callto `webpack-serve`, which
leads to `onchange` sending SIGTERM instead of SIGINT to the childprocess it wraps.
The result is that `webpack-serve` remains running, thus keeps the intially configured port and the
next process uses a random port.
@airtonix
airtonix / handlebars-manifest-helper.js
Created January 17, 2018 01:08
Webpack Manifest Consumption in View Engines
var path = require('path');
var CWD = process.cwd();
var pkg = require(path.join(CWD, 'package.json'));
module.exports.register = function (Handlebars) {
var manifestPath = path.resolve(process.cwd(), 'dist', 'Static', 'theme', 'manifest.json');
var manifest;
var errorMessage;
var filecontent;
try {
@airtonix
airtonix / issue-detail.css
Created July 17, 2017 04:40
Jira Agile Work Board
@charset "UTF-8";
/* default */
#ghx-work {
display: flex;
}
#ghx-work #ghx-pool-column {
display: block;
flex: 1;