Skip to content

Instantly share code, notes, and snippets.

View hasnat-we's full-sized avatar

Hasnat WE hasnat-we

  • Watch Enterprise
  • Bangladesh
View GitHub Profile
@JustSteveKing
JustSteveKing / pint.json
Last active March 1, 2024 19:28
Laravel Pint configuration
{
"preset": "per",
"rules": {
"align_multiline_comment": true,
"array_indentation": true,
"array_syntax": true,
"blank_line_after_namespace": true,
"blank_line_after_opening_tag": true,
"combine_consecutive_issets": true,
"combine_consecutive_unsets": true,
@nelson6e65
nelson6e65 / readme.md
Last active November 4, 2022 20:24
PHPStan examples

PHPStan examples

Types

Using string-class<T> generic typehint with static as T

You can use static in generic to refer to the current class. This is useful in trait implementations:

@nelson6e65
nelson6e65 / phpcs.xml
Last active November 4, 2022 20:23
PHP CodeSniffer config for Laravel
<?xml version="1.0" encoding="UTF-8" ?>
<ruleset name="Default">
<description>Coding standard configuration.</description>
<rule ref="PSR12" />
<rule ref="PEAR.Functions.ValidDefaultValue" />
<rule ref="PEAR.Commenting.InlineComment" />
<rule ref="Squiz.Operators.ValidLogicalOperators" />
<rule ref="Squiz.PHP.CommentedOutCode">
<properties>
<property name="maxPercentage" value="50" />
@SuwakoMmh
SuwakoMmh / Gitbridge.md
Last active May 14, 2023 14:30
Using the same SSH key for multiple Github (& co) accounts

Using the same SSH key for multiple Github (& co) accounts

The most known hack is to edit ~/.ssh/config and use a different hostname in place of github.com for each account. (ref this gist)

However, one might still want to use github.com as a hostname for various reasons. Hence this hack idea I had.

1. Creating a bridge user

This may vary depending on the distribution, but for ubuntu or any given useradd :

# useradd -r -m -d /opt/git git
@fabiolimace
fabiolimace / UUIDv6.sql
Last active April 30, 2024 06:04
Functions for generating UUIDv6 and UUIDv7 on PostgreSQL
/*
* MIT License
*
* Copyright (c) 2023-2024 Fabio Lima
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
@coltenkrauter
coltenkrauter / fix-wsl2-dns-resolution
Last active April 30, 2024 09:07
Fix DNS resolution in WSL2
More recent resolution:
1. cd ~/../../etc (go to etc folder in WSL).
2. echo "[network]" | sudo tee wsl.conf (Create wsl.conf file and add the first line).
3. echo "generateResolvConf = false" | sudo tee -a wsl.conf (Append wsl.conf the next line).
4. wsl --terminate Debian (Terminate WSL in Windows cmd, in case is Ubuntu not Debian).
5. cd ~/../../etc (go to etc folder in WSL).
6. sudo rm -Rf resolv.conf (Delete the resolv.conf file).
7. In windows cmd, ps or terminal with the vpn connected do: Get-NetIPInterface or ipconfig /all for get the dns primary and
secondary.
@laravel-shift
laravel-shift / .php-cs-fixer.php
Last active April 9, 2024 14:08
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',
@yinzara
yinzara / github_bitbucket_multiple_ssh_keys.md
Last active May 2, 2024 02:12
Managing SSH keys and repo cloning using multiple accounts on GitHub and BitBucket

Why Multiple SSH keys?

There are numerous reasons you may need to use multiple SSH keys for accessing GitHub and BitBucket

You may use the same computer for work and personal development and need to separate your work.

When acting as a consultant, it is common to have multiple GitHub and/or BitBucket accounts depending on which client you may be working for.

You may have different projects you're working on where you would like to segregate your access.

@Stunext
Stunext / HandlePutFormData.php
Created November 20, 2018 20:12
Laravel: Middleware to support multipart/form-data in PUT, PATH and DELETE requests
<?php
namespace App\Http\Middleware;
use Closure;
use Symfony\Component\HttpFoundation\ParameterBag;
/**
* @author https://github.com/Stunext
*
@simonhamp
simonhamp / AppServiceProvider.php
Last active March 26, 2024 15:56
A pageable Collection implementation for Laravel
<?php
namespace App\Providers;
use Illuminate\Support\Collection;
use Illuminate\Pagination\LengthAwarePaginator;
class AppServiceProvider extends ServiceProvider
{
public function boot()