Skip to content

Instantly share code, notes, and snippets.

View cptSwing's full-sized avatar

Jens cptSwing

View GitHub Profile
/* eslint-disable no-console */
import { cloneDeep } from 'lodash';
type DevConsoleOptions = {
errorHandlerName?: string;
printStack?: boolean;
clone?: boolean; // clone the argument (to create a snapshot at time of execution) ?
devMode?: boolean; // boolean value to use instead of NODE_ENV
};
@cptSwing
cptSwing / 3dCarousel.tsx
Created August 1, 2022 13:27
3D Carousel using Typescript-React; and mostly Tailwind
/**
* From: https://github.com/suhailsulu/react-carousel-3d ; edited for TS & TW
*/
import { useState, useEffect, useRef } from 'react';
import { useSwipeable } from 'react-swipeable';
import './3dCarouselStyles.css';
interface CarouselProps {
slides:
@cptSwing
cptSwing / compact_vhds.ps1
Last active March 16, 2022 17:19
Windows PowerShell script to compact WSL's virtual hd - run PowerShell as admin
# before running, execute Set-ExecutionPolicy RemoteSigned so that your PowerShell will allow it to run
$ErrorActionPreference="Stop"
Write-Host "Cleaning up packages and fstrim - " -NoNewLine
$SUDOSECUREPASSWORD = Read-Host "please enter your sudo password" -AsSecureString
Write-Host ""
# convert to usable String
$SUDOPASSWORD = [Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR($SUDOSECUREPASSWORD))
@cptSwing
cptSwing / Horiz. Scroll (OneNote for example)
Created October 1, 2021 14:31
I added this in StrokesPlus as an application only script, and set the gestures to react to middle mouse button, left and right 'swipe'
// last element in array
var lastGesturePointInArray = action.GesturePoints.Length - 1;
// pixels travelled
var distanceTravelled = action.GesturePoints[lastGesturePointInArray].X - action.GesturePoints[0].X;
// Edit if need be:
var horizScrollDist = 1.5;
// turn to absolute num