Skip to content

Instantly share code, notes, and snippets.

@multimentha
multimentha / Diablo 2 item filter.xml
Last active May 30, 2021 01:53
Notepad++ syntax highlighting for Diablo 2 loot filters
<NotepadPlus>
<UserLang name="D2 item filter" ext="filter" udlVersion="2.1">
<Settings>
<Global caseIgnored="no" allowFoldOfComments="yes" foldCompact="no" forcePureLC="0" decimalSeparator="0" />
<Prefix Keywords1="yes" Keywords2="no" Keywords3="no" Keywords4="no" Keywords5="no" Keywords6="no" Keywords7="no" Keywords8="no" />
</Settings>
<KeywordLists>
<Keywords name="Comments">00// 01 02 03 04</Keywords>
<Keywords name="Numbers, prefix1"></Keywords>
<Keywords name="Numbers, prefix2"></Keywords>
@multimentha
multimentha / instance_create_crop.gml
Created August 2, 2019 11:06
GameMaker Studio - FriendlyCosmonaut's Farming RPG Tutorial: require player to to be close to the soil
///@description instance_create_crop
///@arg x
///@arg y
///@arg crop_type
// snap x,y position to a grid
var cs = crops.cell_size;
var gx = argument0 div cs;
var gy = argument1 div cs;
var i_grid = crops.ds_crop_instances;
@multimentha
multimentha / example_07_03_modularity.pde
Created January 9, 2018 21:47
Learning Processing Example 7-4 Suggested Change Corrected (2nd edition, p. 123)
// Learning Processing
// Daniel Shiffman
// http://www.learningprocessing.com
// Example 7-3: Bouncing ball with functions
// Declare all global variables (stays the same)
int x = 0;
int speed = 1;
@multimentha
multimentha / Python 3 generator example.md
Last active May 27, 2017 21:42
A simple example of how to use generators in Python 3. Explanations on when it's a good idea to use generators.

In Python, generators are helper objects for managing long sequences of data. When list or tuple is created, it loads all its items into memory at once. A generator, by contrast, only loads and returns 1 item at a time.

In this example, we'll access a list of common Dutch surnames via a generator!

Side note: The for x in y construct actually makes a generator of the iterable y.

# Break this string of numbers into a sequence of 1 digit and 2 digit numbers without changing their relative order.
# Input : 1234
# Output : {1,2,34} {1,23, 4} {1,2,3,4} {12,34} {12,3,4}
def recursive_split(seq: str) -> tuple:
# check for valid strings
if not seq or len(seq) == 0:
result = [()]
# base case
elif len(seq) == 1:
#!/usr/bin/env python
# GIMP UI examples of options
# Feedback welcome: jacksonbates@hotmail.com
from gimpfu import *
def ui_examples_1(int_var, float_var, string_var, value_var, color_var,
colour_var, image_var, layer_var, channel_var, drawable_var,
toggle_var, boolean_var):