Skip to content

Instantly share code, notes, and snippets.

View koteelok's full-sized avatar
🤠

Musa Asukhanov koteelok

🤠
View GitHub Profile
// ==UserScript==
// @name Quick Web Build
// @namespace http://tampermonkey.net/
// @version 2025-10-03
// @description Adds button that will auto-click some buttons for you to build a game.
// @author koteelok
// @match https://editor.construct.net/
// @icon https://editor.construct.net/r449-2/media/icon-512.png
// @grant none
// ==/UserScript==
@koteelok
koteelok / screen.js
Created September 3, 2023 19:52
Fit rect to window.
export function fitRectToWindow(width: number, height: number) {
return width / height < window.innerWidth / window.innerHeight
? {
x: (window.innerWidth - width * (window.innerHeight / height)) / 2,
y: 0,
width: width * (window.innerHeight / height),
height: window.innerHeight,
}
: {
x: 0,
@koteelok
koteelok / subscribleDecorator.ts
Last active February 13, 2023 17:48
Subscribable objects JS
type ObjectLike = { [keys: string]: any };
type ObserverCallback<O extends ObjectLike = any> = (obj: O) => void;
type StringKeys<O extends ObjectLike> = keyof O & string;
class ObjectCallbacks {
private callbacks: { [key: string]: Set<ObserverCallback> } = {};
constructor() {}
getCallbacks(key: string) {