Skip to content

Instantly share code, notes, and snippets.


Immanuel Hzzkygcs

View GitHub Profile
zgoda /
Last active August 2, 2022 03:16
Load svg into Pygame image using pynanosvg (
from svg import Parser, Rasterizer
import pygame
import sys
def load_svg(filename, mode='RGBA', scale=None, size=None, clip_from=None, fit_to=None):
"""Returns Pygame Image object from rasterized SVG
If scale (float) is provided and is not None, image will be scaled.
branneman /
Last active March 20, 2023 05:49
Better local require() paths for Node.js

Better local require() paths for Node.js


When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions