Skip to content

Instantly share code, notes, and snippets.

View nklbdev's full-sized avatar

nklbdev nklbdev

View GitHub Profile
@nklbdev
nklbdev / true_parallax.gd
Last active June 17, 2025 20:08
True parallax script for Godot 4
## This script adds parallax functionality to any Node2D.
## But be careful, some Node2D descendants may work in a special way
## with the position and global_position properties,
## or have other conflicts with the logic of this script.[br]
##
## [b]How to use[/b]: Add this script to any [Node2D],
## such as [TileMapLayer] or [Sprite2D], or to [Node2D] itself.
## Or move the main sections of the code to your own script.[br]
## After that, this node will have new properties that allow you
## to configure parallax and see it working in the editor just like in the game.[br]
@nklbdev
nklbdev / run_as_with_saved_creds.ps1
Created July 21, 2023 18:49
PowerShell script to run a command as another user with saved credentials
# Usage:
#
# Call it without any args except path to file to save credential.
# The script will show a window for entering credentials and save them to a file in encrypted form.
# > powershell -File run_as_with_saved_creds.ps1 creds.txt
#
# Call it with arguments after path to file with saved credential.
# The script will execute the command as the user whose credentials have been saved in the file.
# > powershell -File run_as_with_saved_creds.ps1 creds.txt some commands and args
@nklbdev
nklbdev / Option.cs
Created March 2, 2023 16:40
Option pattern C# implementation
public interface IOption<T> : IEnumerable<T>
{
bool IsSome { get; }
T Value { get; }
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
}
public static class Option
{
public static IOption<T> Some<T>(T value) => new Some<T>(value);
@nklbdev
nklbdev / FunctionalBuilder.cs
Last active December 13, 2019 06:43
Primitive universal functional builder
public static class Building
{
public static Func<T> Provide<T>(Func<T> provider) => provider;
public static Func<T> Provide<T>(T value) => () => value;
public static Func<T> With<T>(this Func<T> provider, Action<T> modifier) =>
With(provider, modifier, out _);
public static Func<T> With<T>(this Func<T> provider, Action<T> modifier, out Func<T> thisStep)
{
@nklbdev
nklbdev / README.md
Last active April 29, 2018 18:54
Lua events

SIMPLE EVENTS FOR LUA

Description will be added later