Skip to content

Instantly share code, notes, and snippets.

View foxfabi's full-sized avatar

Fabian Dennler foxfabi

View GitHub Profile
@foxfabi
foxfabi / entity.class.php
Last active February 17, 2021 16:08
PHP Entity class providing CRUD operations for a database table
<?php
/**
* Generate an entity object that provide CRUD operation for a database table.
*
* Some examples:
*
* // New Instance
* $users = new Entity($link, "users");
*
@evaera
evaera / Clean Code.md
Last active June 15, 2024 14:42
Best Practices for Clean Code
  1. Use descriptive and obvious names.
    • Don't use abbreviations, use full English words. player is better than plr.
    • Name things as directly as possible. wasCalled is better than hasBeenCalled. notify is better than doNotification.
    • Name booleans as if they are yes or no questions. isFirstRun is better than firstRun.
    • Name functions using verb forms: increment is better than plusOne. unzip is better than filesFromZip.
    • Name event handlers to express when they run. onClick is better than click.
    • Put statements and expressions in positive form.
      • isFlying instead of isNotFlying. late intead of notOnTime.
      • Lead with positive conditionals. Avoid if not something then ... else ... end.
  • If we only care about the inverse of a variable, turn it into a positive name. missingValue instead of not hasValue.
@kekru
kekru / 1-WSL and Docker for Windows.md
Last active January 21, 2023 17:12
Windows 10 Subsystem for Linux combined with Docker for Windows

Using Windows Subsystem for Linux combined with Docker for Windows

Docker CE for Windows

  • Install Docker CE for Windows
  • Go to Docker for Windows Settings -> General and enable Expose daemon on tcp://localhost:2375 without TLS.
    This will enable the Docker remote API for requests, coming from localhost, not from another computer in your network. A TLS secured version is not yet supported in Docker for Windows. See docker/for-win#453 for more information. I also tried a daemon.json file with options tlscacert, tlscert, tlskey and tlsverify, but Docker for Windows crashed on booting.

Install Windows Subsystem for Linux (WSL)

@hamoid
hamoid / theme.txt
Last active March 3, 2023 03:11
Processing 3.5.4 IDE dark theme. See thread for 4.0 version (haven't tested it, 4.0b4 crashes for me).
# Processing 3.5.4 IDE - dark theme
# Updated version by @RandomGuy3015
# File location: processing-3.5.4/lib/theme.txt
# Make a backup of the original theme.txt
# Then replace it with this code
# Code colors can be adjusted in the preferences.txt file
@paulmoore
paulmoore / Animal.lua
Created December 4, 2011 07:06
A simple Class implementation in Lua for Object-Oriented Programming.
--- Animal.lua
--
-- A simple example of a base class usng the classes library.
--
-- @author PaulMoore
--
-- Copyright (C) 2011 by Strange Ideas Software
--
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to deal