Skip to content

Instantly share code, notes, and snippets.

@StephenHaney
StephenHaney / AutoPan.tsx
Created September 11, 2023 05:00
Modulz AutoPan on dragging
import { autorun } from 'mobx';
import { observer } from 'mobx-react-lite';
import React, { useEffect, useRef } from 'react';
import { useAppState } from 'src/store/context/AppStateProvider';
/** Moves the pan of the canvas if a cursor leaves the edges of the canvas during a drag */
export const AutoPan = observer(() => {
const { hoverState, dragState, cameraState, toolState, selectionState } = useAppState();
/** A RAF for the autopan function */
const autoPanAnimationFrame = useRef<number>(0);

Variables

const shade = 100;
type Shade = 100;

Functions

// TODO: make `pages` optional and measure the div when unspecified, this will
// allow more normal document flow and make it easier to do both mobile and
// desktop.
import {
createContext,
useCallback,
useContext,
useEffect,
useMemo,
useRef,
@daviddarnes
daviddarnes / email.md
Created November 14, 2021 17:17
Cold email recruiter email template

Hey,

Can you tell me where you got my details, my name and email, from? Legally you must provide this information. Also you’re breaking data protection law by storing my information without my consent, so please remove it or else I’ll need to report you to the ICO.

Thanks

@linderd
linderd / README.md
Last active March 13, 2024 19:06 — forked from timlinux/README.md
Linux on Thinkpad P14s Gen2 AMD / T14 Gen2 AMD

Linux (Fedora 35) on a Thinkpad P14s [T14] Gen2 AMD

These are my installation-tricks and notes for running Linux on a 2021 Thinkpad P14s Gen2 with AMD Ryzen 7 5850U. It should also be suitable for the Thinkpad T14 Gen2 AMD as they are technically the same modell.
Meanwhile there is also a good test on youtube and an entry in the arch-wiki, which also comments some points mentioned here.

Detailed specs

Shipped:

@sreetamdas
sreetamdas / a-rendezvous-with-cassidoo.md
Last active November 22, 2023 13:56
Rendezvous with Cassidoo: solutions to interview questions of the week from the [rendezvous with cassidoo newsletter](https://buttondown.email/cassidoo)

Rendezvous with Cassidoo Solutions

Solutions to the interview question of the week from the rendezvous with cassidoo newsletter

Solutions in the following languages:

  • TypeScript
  • Elixir

Inspired and forked from jda0

@jziggas
jziggas / nowhal.js
Last active March 29, 2024 12:34
JavaScript to delete all of your Reddit comments
// Go to https://www.reddit.com/user/<username>/ and paste into your console.
// Reddit throttles these actions, hence the 1s timer.
let interval = setInterval(() => {
let deleteButtons = $('a.togglebutton[data-event-action="delete"]');
if (deleteButtons.length === 0) {
clearInterval(interval);
if ($('.next-button > a')[0]) {
$('.next-button > a')[0].click();
alert('Restart script.');
}
@yorickvP
yorickvP / boxblurcanvas.js
Created January 16, 2012 14:31
Fast canvas box blur
/*
BoxBlur - a fast almost Box Blur For Canvas
Edited by Yorick to make it faster in modern browsers
Version: 0.3
Author: Mario Klingemann
Contact: mario@quasimondo.com
Website: http://www.quasimondo.com/