Skip to content

Instantly share code, notes, and snippets.

View MartinMajewski's full-sized avatar

Martin Majewski MartinMajewski

View GitHub Profile
@fenix-hub
fenix-hub / #description.md
Last active July 12, 2024 21:49
GDScript JSON <> Class Serializer/Deserializer

You can find usages in the GDScript Unirest plugin

This is a fast serializer/deserializer written in GDScript to convert a JSON (Dictionary) to a class, using something similar to the Reflection concecpt. json_to_class can be used to convert a Dictionary to a Class. All keys in the Dictionary will be treated as variables and their types will be guessed in the best way possible. A class (defined by the class_name keyword) must extend Reference or Object or be an inner class, or else Godot will not able to see its properties. It is also possible to deserialize a JSON key to a class property with a different name using the export hint as a variable name.

example usage:

@CharlesGodwin
CharlesGodwin / setup-poe-hat.sh
Last active December 1, 2023 13:37
How to set up the WaveShare Raspberry Pi PoE HAT Type (B) with display
#!/bin/bash
# 2022-01-01 Charles Godwin
# Derived from https://www.waveshare.com/wiki/PoE_HAT_(B)
# enable i2c interface if necessary
# Read the following for details
# https://gist.github.com/CharlesGodwin/adda3532c070f6f6c735927a5d6e8555#file-waveshare-poe-hat-md
#
IS_I2C=`sudo raspi-config nonint get_i2c`
[ $IS_I2C -ne 0 ]&&sudo raspi-config nonint do_i2c 0
# install required packages
@daniloc
daniloc / SimpleColorPicker.swift
Last active April 21, 2023 09:48
A simple color picker with enum for easy storage
struct ColorPicker: View {
enum Option: Int, CaseIterable {
case none,
red,
orange,
yellow,
green,
teal,
blue,