Skip to content

Instantly share code, notes, and snippets.

@laravel-shift
laravel-shift / .php-cs-fixer.php
Last active March 29, 2025 12:18
PHP CS Fixer - Laravel Coding Style Ruleset
<?php
use PhpCsFixer\Config;
use PhpCsFixer\Finder;
$rules = [
'array_indentation' => true,
'array_syntax' => ['syntax' => 'short'],
'binary_operator_spaces' => [
'default' => 'single_space',
@xirixiz
xirixiz / Set up GitHub push with SSH keys.md
Last active April 2, 2025 16:20 — forked from developius/README.md
Set up GitHub push with SSH keys

SSH keypair setup for GitHub (or GitHub/GitLab/BitBucket, etc, etc)

Create a repo.

Make sure there is at least one file in it (even just the README.md)

Generate a SSH key pair (private/public):

ssh-keygen -t rsa -C "[email protected]"
@azhararmar
azhararmar / Symfony - Manual User Authentication
Last active June 21, 2024 08:44
Manually Authenticate User In Symfony
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
// Manually authenticate user in controller
$token = new UsernamePasswordToken($user, null, 'main', $user->getRoles());
$this->get('security.token_storage')->setToken($token);
$this->get('session')->set('_security_main', serialize($token));
@wojteklu
wojteklu / clean_code.md
Last active April 15, 2025 22:01
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

1. Make Home Directory for SShH keys.
c://users/UserName/.SSH (for Windows 7)
2. Generate SSH key by command:
ssh-keygen -t rsa -C "[email protected]"
# Creates a new ssh key, using the provided email as a label
Generating public/private rsa key pair.
It's created a pair of keys - private and public in home dir .SSH
C:\Users\SuvorovAG\.ssh\id_rsa
@rodrigopedra
rodrigopedra / gist:a4a91948bd41617a9b1a
Last active January 18, 2025 23:52
Laravel 5 Middleware for Database Transactions
<?php namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Response;
class DBTransaction
{
/**
* Handle an incoming request.
*