Skip to content

Instantly share code, notes, and snippets.

@oakfang
oakfang / js.py
Last active April 7, 2023 04:45
How to import js modules into python
import sys
import jiphy # pip install
from os import path
from types import ModuleType
class JsFinder(object):
def find_module(self, name, m_path):
name += '.js'
if m_path is not None:
@johnsoncodehk
johnsoncodehk / ClampAngle.cs
Last active April 12, 2024 16:31
Unity Clamp Angle
public static float ClampAngle(float angle, float min, float max) {
float start = (min + max) * 0.5f - 180;
float floor = Mathf.FloorToInt((angle - start) / 360) * 360;
return Mathf.Clamp(angle, min + floor, max + floor);
}
### Flatpak Repos
List packages on a repo :
flatpak remote-ls repon-name --user
flatpak remote-ls
Install packages :
flatpak --user install repo-name package-name io.liri.Platform
Flathub:
@deakcor
deakcor / shadow2d.shader
Last active June 27, 2024 20:07
Shadow 2D for Godot Engine
/**
* Shadow 2D.
* License: CC0
* https://creativecommons.org/publicdomain/zero/1.0/
*/
shader_type canvas_item;
render_mode blend_mix;
uniform vec2 deform = vec2(2.0, 2.0);
uniform vec2 offset = vec2(0.0, 0.0);
@thygrrr
thygrrr / CameraZoomAndPan.gd
Last active June 13, 2024 01:05
CameraZoomAndPan.gd - Smooth, cursor-centric 2D Zoom for Godot
# SPDX-License-Identifier: Unlicense or CC0
extends Node2D
# Smooth panning and precise zooming for Camera2D
# Usage: This script may be placed on a child node
# of a Camera2D or on a Camera2D itself.
# Suggestion: Change and/or set up the three Input Actions,
# otherwise the mouse will fall back to hard-wired mouse
# buttons and you will miss out on alternative bindings,
# deadzones, and other nice things from the project InputMap.