Skip to content

Instantly share code, notes, and snippets.

View alphaolomi's full-sized avatar
🎯
Focusing

Alpha alphaolomi

🎯
Focusing
View GitHub Profile

Github Labels Guide

1 Guide Assumptions

This guide is created to make work with labels on Github more constructive and understandable both to development and management parts of the team.

Here's the base sanitizer:

<?php

namespace FooProject\Internal\Sanitizers;

abstract class BaseSanitizer
{
    /**
@alphaolomi
alphaolomi / check_extensions.php
Created July 1, 2022 19:41
Check all required PHP extension for Laravel
<?php
// OpenSSL PHP Extension
// PDO PHP Extension
// Mbstring PHP Extension
// Tokenizer PHP Extension
// XML PHP Extension
// SQLite PHP Extension (for SQLite3 support)
$extensionsList = [
@alphaolomi
alphaolomi / guide.md
Created June 25, 2022 18:08
OPINIONATED DEFINITION OF QUALITY

OPINIONATED DEFINITION OF QUALITY for PHP packages

Based on thephpleague Definition

  1. Use a vendor namespace (Alphao in my case) for PSR-4 autoloading. Place code in a src folder.

  2. Adhere to PSR-2 as the coding style guide.

@alphaolomi
alphaolomi / remove_laravel_comments.php
Created June 16, 2022 22:41 — forked from jakebathman/remove_laravel_comments.php
Remove comments from fresh Laravel files
<?php
/*
|--------------------------------------------------------------------------
| Remove Laravel Comments
|--------------------------------------------------------------------------
|
| Just made a new Laravel project, but don't want all those big
| comment blocks? Put this in the root of your project and run
| "php remove_laravel_comments.php"
|
@alphaolomi
alphaolomi / composer.json
Created May 28, 2022 01:57
Composer.json minimal stub
{
"name": "name/example",
"description": "demo",
"type": "project",
"license": "MIT",
"authors": [
{
"name": "Your Name",
"email": "[email protected]"
}
@alphaolomi
alphaolomi / fresh.md
Created May 25, 2022 19:18
Fresh Parrot Linux

fresh linux

sudo apt update
sudo apt full-upgrade

ToC

  1. php
  2. node
@alphaolomi
alphaolomi / node_mailer.mjs
Created April 29, 2022 13:50
Test Node mailer smtp transaport
import { createTransport } from "nodemailer";
const smtpConnection = createTransport({
host: "smtp-relay.sendinblue.com",
port: 587,
auth: {
user: process.env.SMTP_USER || "",
pass: process.env.SMTP_PASSWORD || "",
},
});
@alphaolomi
alphaolomi / HTML_Form_Validation.md
Created March 29, 2022 22:20
Warning: HTML form validation

HTML form validation

Warning: HTML form validation is not a substitute for server-side scripts that ensure the entered data is in the proper format before it is allowed into the database. It's far too easy for someone to make adjustments to the HTML that allow them to bypass the validation, or to remove it entirely. It's also possible for someone to bypass your HTML entirely and submit the data directly to your server. If your server-side code fails to validate the data it receives, disaster could strike when improperly-formatted data (or data which is too large, is of the wrong type, and so forth) is entered into your database.

@alphaolomi
alphaolomi / email_validation.ts
Last active March 27, 2022 20:42
Node.js Email Validation
const validateEmail = (email: string) => {
const re =
/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
return re.test(String(email).toLowerCase());
};
const ifElse = (condition: boolean, ifTrue: any, ifFalse: any) => {
return condition ? ifTrue : ifFalse;
};