Skip to content

Instantly share code, notes, and snippets.

View michitheonlyone's full-sized avatar
🏠
Working from home

Michael Ihde michitheonlyone

🏠
Working from home
View GitHub Profile
@michitheonlyone
michitheonlyone / PHP8_DependencyInjection.php
Last active January 28, 2022 10:44
PHP 8 new Dependency Injection vs PHP 7.4
<?php declare(strict_types=1);
// PHP 8
final class DependencyInjectionExampleNew
{
public function __construct(private string $var) {}
}
// PHP 7.4
final class DependencyInjectionExample
@michitheonlyone
michitheonlyone / arrow-functions.js
Created September 24, 2021 11:39
JavaScript Cheatscheet
// Async arrow functions look like this:
const foo = async () => {
// do something
}
// Async arrow functions look like this for a single argument passed to it:
const foo = async evt => {
@michitheonlyone
michitheonlyone / PHPAnonymusFunctions.php
Last active July 7, 2023 10:41
PHP Anonymus Function
<?php implode("\n", array_map(function($inst){ return "- ".$inst->getUrl()->toString(); }, $customer->getInstallations()->toArray()))
@michitheonlyone
michitheonlyone / Encrypter.php
Last active August 30, 2022 09:35
PHP Encryption Class to encrypt strings to encrypted json using openssl library (Stolen from Laravel)
<?php declare(strict_types=1);
// namespace...
final class Encrypter
{
private string $key;
private string $cipher;
const DEFAULT_CIPHER = 'AES-256-CBC';
@michitheonlyone
michitheonlyone / NPM Bootstrap Icons JS Import
Last active September 3, 2021 14:51
Helpful NPM commands and Help for Bootstrap/ Bootswatch and Startbootstrap #bootstrap #startbootstrap #bootswatch #npm
npm i bootstrap-icons
import "../node_modules/bootstrap-icons/font/bootstrap-icons.css";
@michitheonlyone
michitheonlyone / ApplicationFilter.php
Last active August 25, 2021 14:55
PHP Doctrine DBAL Variable Filter Value Class
<?php declare(strict_types=1);
namespace Acme\Common\Application;
final class Filter
{
private string $column;
private int $option;
private string $value;