Skip to content

Instantly share code, notes, and snippets.

@Muetze42
Muetze42 / add-windows-context-menu-item.bat
Last active November 10, 2021 09:51
Tested with Windows 11, but should work with older Windows Versions too (Example with Umlauts for Mp3tag)
goto comment
/*
|--------------------------------------------------------------------------
| Instruction
|--------------------------------------------------------------------------
|
| * With Notepadd++
| * [For specialchars and Umlauts] `Encoding` => `Convert to ANSI`
| * [For specialchars and Umlauts] `Language` => `M` => `MS-Dos Style`
@Muetze42
Muetze42 / NovaNoDuplicateRelations.php
Last active November 10, 2021 09:51
Nova: Prevent duplicate relation attachment
<?php
namespace App\Traits\Nova;
use Illuminate\Database\Eloquent\Builder;
use Laravel\Nova\Http\Controllers\AttachableController;
use Laravel\Nova\Http\Requests\NovaRequest;
trait NoDuplicateRelations
{
@Muetze42
Muetze42 / nova-indexquery-default-order.php
Last active November 10, 2021 09:52
Laravel Nova: indexQuery Default order
<?php
/**
* The column by which to sort as default
*
* @var string
*/
public static string $defaultSort = '';
/**
@Muetze42
Muetze42 / nova-check-if-filter-is-active.php
Last active November 10, 2021 09:52
Laravel Nova: Check if filter is active
<?php // Functions
if (!function_exists('decodeNovaFilter')) {
/**
* Decode the filter string from base64 encoding.
*
* @param string $filtersRequestString
* @return array
*/
function decodeNovaFilter(string $filtersRequestString): array
{
/.idea
/.vscode
/.vs
/node_modules
/vendor
@Muetze42
Muetze42 / .htaccess
Created December 10, 2021 07:48
htaccess Whitelisting
#Allow w3c validator
Allow from 128.30.52.73
Allow from 128.30.52.96
Allow from .w3.org
#Allow PayPal
Allow from 151.101.129.21
Allow from .paypal.com
@Muetze42
Muetze42 / functions.php
Last active December 21, 2021 09:04
WordPress: HTML lang in ISO 639-1 Language Codes
<?php
add_filter('language_attributes', function () {
return 'lang="'.explode('-', get_bloginfo('language'))[0].'"';
}, 10, 2);
@Muetze42
Muetze42 / DownCommand.php
Created December 31, 2021 20:25
Laravel: Default View For Maintenance Mode
<?php
namespace App\Console\Commands;
use Illuminate\Foundation\Console\DownCommand as Command;
use Illuminate\Foundation\Exceptions\RegisterErrorViewPaths;
class DownCommand extends Command
{
/**
@Muetze42
Muetze42 / auth.json
Last active January 21, 2022 08:37
Your GitHub OAuth token for github.com contains invalid characters on composer install
// `nano ~/.composer/auth.json`
//
// Basic- and OAuth:
{
"http-basic": {
"github.com": {
"username": "[GITHUB-USERNAME]",
"password": "ghp_[PERSONAL-TOKEN]"
},
"nova.laravel.com": {
@Muetze42
Muetze42 / Plesk: Additional deployment actions
Last active March 3, 2022 20:27
Plesk: Additional deployment actions
/opt/plesk/php/8.1/bin/php artisan config:clear
/opt/plesk/php/8.1/bin/php /usr/lib/plesk-9.0/composer.phar install --optimize-autoloader --no-dev
/opt/plesk/php/8.1/bin/php artisan migrate --force
/opt/plesk/php/8.1/bin/php artisan view:clear
/opt/plesk/php/8.1/bin/php artisan optimize