Skip to content

Instantly share code, notes, and snippets.

View trurl-master's full-sized avatar

Ivan Galiatin trurl-master

View GitHub Profile
@trurl-master
trurl-master / rotatedBBoxSize.ts
Created November 20, 2021 18:04
Calculate rotated bounding box size
export function rotateSize(width: number, height: number, rotation: number): { width: number, height: number } {
const rotRad = (rotation * Math.PI) / 180
return {
width: Math.abs(Math.cos(rotRad) * width) + Math.abs(Math.sin(rotRad) * height),
height: Math.abs(Math.sin(rotRad) * width) + Math.abs(Math.cos(rotRad) * height),
}
}
@trurl-master
trurl-master / chess-com-no-click-move.js
Last active April 24, 2021 19:53
Chess.com no click move
/**
Welcome to the reverse engineering hell!
The idea is to disable pointer interactions with the board
(with the exception of my pieces) when my piece is selected
Known issues:
- it won't work if your pieces are on top ("flipped" check
that is used to determine "my" pieces is wrong in that case)
*/