Skip to content

Instantly share code, notes, and snippets.

View BenMakesGames's full-sized avatar

Ben Hendel-Doying BenMakesGames

View GitHub Profile
=begin
positions events with "Walk Animation" checked 8 pixels higher. for events that
represent NPCs, this places their feet closer to the center of the tile they're
standing in, rather than the bottom. this looks better on most RTP tilesets.
considerations:
* RPG Maker has "Walk Animation" on by default for ALL events. when using this
script, you should uncheck "Walk Animation" for events except those
representing NPCs. if you're adding this to an existing project, updating all
of your existing events could be a LOT of work.
# I did not make this script, a user named "Shaz" did, on this
# thread: http://forums.rpgmakerweb.com/index.php?/topic/9139-simple-slopes/
# I made trivial modifications, and fixed an issue where characters
# would sometimes face in weird directions when moving on stairs.
# terrain tag for stairs sloping from the bottom-left to upper-right
SLOPE_UP_TAG = 4
# terrain for stairs sloping from the top-left to bottom-right
SLOPE_DOWN_TAG = 6
# assuming you have the MOG Character Select script installed, this script
# makes it so that selecting "New Game" from the title menu jumps directly
# into the Character Select script. once you select a character, the game
# begins.
# note that using this script renders the Character Select useless EXCEPT
# when starting a new game. calling it at any other time will have weird
# effects.
# the MOG Character Select script can be found here:
# http://atelier-rgss.com/RGSS/Menu/ACE_Menu07.html
@BenMakesGames
BenMakesGames / random-helpers.js
Last active January 27, 2018 17:54
Random Helpers: some JS extensions to help you generate quick random content for funsies (not for use where security is a priority)
/**
* @see {@link https://gist.github.com/BenMakesGames/58c5307108b74b4995c60a7b056ab04f}
* @file These methods make no attempt to be SECURE, in terms of the sorts of concerns that cryptography might be
* worried about. They're intended to be used to quickly make FUN things, like procedurally-generated content for a
* game. If you care about generating passwords or other secure keys, do not use these methods.
* @author Ben Hendel-Doying
*/
/**
* Returns a random integer between min and max, inclusive. (The way a human might "naturally" expect.)

why LINQ is great

LINQ lets you manipulate collections super-easily, eliminating the need for loops and temporary variables in many cases.

here's a simple example: finding even numbers from a list of numbers, using a loop:

public List<int> FindEvenNumbers(List<int> numbers)
{
 var evenNumbers = new List();

S-Tier

In no particular order.

Kasugai Gummy Candy

I personally find the Kiwi and Lychee ones kind of weird (and I've never tried the Ramune flavor), but by and large, these are fantastic.

Bonus points to the Melon and Yuzu flavors just for being different and uncommon to find in other gummies.

Having fun (or not) with LINQ and nulls

How to Where and Select your nulls away

Suppose I've got this list:

var customers = new List<Customer?>()
{
    new Customer() { Id = 123, CompanyName = "Bla" },

I translated the following methods from Java, for use in C#, over a year ago (sometime in early 2022, or late 2021). Maybe there's better versions of the same elsewhere; I dunno. If this is the best that you - o weary traveller of the internet - could find, then I hope you find them useful for your purposes.

Buy Me a Coffee at ko-fi.com

EncodeFilterValue

You know SQL injection attacks? Well, there's LDAP injection attacks, too.

The following method escapes values which you're tossing into LDAP search strings.

@BenMakesGames
BenMakesGames / contrasting-color.pipe.ts
Last active March 13, 2023 15:41
Angular pipe that returns black if the given color is bright; white if it's dark. supports CSS vars.
// for Angular. a pipe that picks black if the given color is very bright, or white if it's dark. the
// threshhold and exact colors used are easily configured in the code; if you wanted to add them as
// parameters to this method, that modification should be easy enough (although for consistency in
// how you handle colors in your project, you might prefer not to give yourself the choice!)
//
// Buy Me a Coffee? :D https://ko-fi.com/A0A12KQ16
//
// example usage:
//
// <div [ngStyle]="{ 'background-color': someColor, 'color': someColor|contrastingColor }">...</div>
=begin
Can be used to change where faces are displayed in message boxes: the left, or
the right!
To use, place a "Script" in your event BEFORE the "Message". The script should
contain either:
Window_Message.FaceOnLeft
or: