Skip to content

Instantly share code, notes, and snippets.

View fgdaniel's full-sized avatar
Focusing

Florin G Daniel fgdaniel

Focusing
View GitHub Profile
@fgdaniel
fgdaniel / .php-cs-fixer.php
Last active April 4, 2023 09:37
PHP CS Fixer settings
<?php
return (new PhpCsFixer\Config())
->setRules(array(
// '@PSR12' => true,
// basic
'curly_braces_position' => array(
'functions_opening_brace' => 'same_line',
'classes_opening_brace' => 'same_line',
'anonymous_classes_opening_brace' => 'same_line',
@fgdaniel
fgdaniel / PSreadLine.ps1
Created November 1, 2022 12:59
Powershell utils
# Add PSReadLine
# https://github.com/PowerShell/PSReadLine
# https://devblogs.microsoft.com/powershell/announcing-psreadline-2-1-with-predictive-intellisense/
# https://docs.microsoft.com/en-us/powershell/module/psreadline/set-psreadlineoption?view=powershell-7.2
#--------------------
Import-Module PSReadLine
Set-PSReadLineOption -PredictionSource HistoryAndPlugin
Set-PSReadLineOption -PredictionViewStyle ListView
Set-PSReadLineOption -EditMode Windows
@fgdaniel
fgdaniel / custom-permalink-for-post-type.php
Last active April 18, 2024 03:02
Custom permalink from the root of the site
<?php
if (!defined('ABSPATH')) return; // Exit if accessed directly.
// Attention
// You must have ACF and ACF Extended installed, you need a group made with a slug field that will be called 'custom_permalink' and select on which post-type to appear. Example: https://i.imgur.com/aTNpHoU.png
// For custom permalink of an archive you have to activate the option here: https://i.imgur.com/SOvcbBj.png and in the group with the field 'custom_permalink' you have to select on which archive to appear, example: https://i.imgur.com/dKLfDEJ.png
// Example of an archive: https://i.imgur.com/owENTRB.png if you do not complete 'custom_permalink' then the default will be the '$default_slug' variable
// If you do not want custom url rewrite on an archive you can comment the line 'add_filter('post_type_archive_link', [$this, 'archive_link'], 10, 2);' and line '$rules['^' . $custom_url . '/?$'] = $path;'
// Replace 'example' with your post-type name
@fgdaniel
fgdaniel / .bashrc
Last active November 15, 2021 13:07
bash aliases commands
# ----------------------
# Git Command Aliases
# ----------------------
# Arg1 = target branch
function add_branch() {
git checkout -b $1 && git push -u origin $1
}
alias add_branch=add_branch