Skip to content

Instantly share code, notes, and snippets.

View Hzzkygcs's full-sized avatar
😄

Immanuel Hzzkygcs

😄
View GitHub Profile
@zgoda
zgoda / svgsurf.py
Last active August 2, 2022 03:16
Load svg into Pygame image using pynanosvg (https://github.com/ethanhs/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
branneman / better-nodejs-require-paths.md
Last active April 25, 2024 13:21
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

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