Skip to content

Instantly share code, notes, and snippets.

View Bachsau's full-sized avatar

Bachsau

View GitHub Profile
@Bachsau
Bachsau / configuration_manager.py
Last active March 2, 2023 15:29
A simple abstraction of Python’s ConfigParser
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# A simple abstraction of Python’s ConfigParser.
# It features implicit type conversion and defaults through prior
# registration of settings. It can be used to save and read settings
# without bothering about the specifics of ConfigParser or the INI files
# themselves. It could also serve as a starting point to abstract
# platform-specific saving methods through its general API.
@Bachsau
Bachsau / stop_dangerous_names.php
Last active August 27, 2020 19:37
Stop PHP’s dangerous name handling
<?php
// Stop PHP’s dangerous name handling
function undefined_name_error($errno, $errstr, $errfile='', $errline=0, $errcontext=NULL) {
if (stripos($errstr, 'Undefined') !== false) {
error_log("PHP Fatal error: $errstr in $errfile on line $errline");
exit(255);
}
else {
return false;