Skip to content

Instantly share code, notes, and snippets.

View Whoeza's full-sized avatar
🙉
I may be slow to respond.

Chuck Whoeza

🙉
I may be slow to respond.
View GitHub Profile
@Whoeza
Whoeza / longest_prefix.py
Created April 7, 2024 20:10
longest common prefix in a list of strings
# longest_prefix.py
def longest_prefix(strings_list: list[str, ...]) -> str:
if strings_list is None:
return None
if 0 == len(strings_list):
return ""
common_prefix = ""
max_prefix_length = min(
len(item)
@Whoeza
Whoeza / sliding_window_tutorial.py
Created March 29, 2024 18:22
[Python] Sliding window tutorial
# sliding_window_tutorial.py
# We have an array, a.k.a. a list.
my_array = [1, 2, 3, 4, 5,
6, 7, 8, 9, 10,
11, 12, 13, 14, 15,
16, 17, 18, 19, 20]
print("my_array: %s" % my_array)
print()
# my_array: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]
@Whoeza
Whoeza / sql-elegant-coding-style.sql
Last active March 29, 2024 18:29
SQL coding style: getting to the state of writing elegant SQL code
-- First, you want to break down the formatting style called "river",
-- where keywords align to form a river:
SELECT 'something', 'hey there',
'more stuff',
'42'
FROM dual
WHERE 1=1
;
-- After that's done, start dividing your database into sub-tables with the use of `with`,
@Whoeza
Whoeza / _improve_fivem_resources.md
Created April 18, 2023 09:52 — forked from nnsdev/_improve_fivem_resources.md
How to improve FiveM resource performance

How to fix resource performance

Showing by example of "disc-base" exempts

This is an example of a resource called "disc-base", I have only taken parts of it and removed the mentions of ESX, because I am running this on an empty server. The part we are looking at here especially is the marker drawing. This is also an outdated version of this resource before they applied performance improvements, but we are also going to go deeper than their changes.

Base of this tutorial: https://github.com/DiscworldZA/gta-resources/blob/54a2aaf7080286c8d49bbd7b1978b6cc430ec755/disc-base/client/markers.lua (client.lua here)

Assessment