Skip to content

Instantly share code, notes, and snippets.

View serguk89's full-sized avatar

Serhii serguk89

  • Kyiv, Ukraine
View GitHub Profile
@serguk89
serguk89 / uploads.conf
Last active February 20, 2024 16:48
nginx wordpress uploads redirect
location ~ "^(.*)/wp-content/uploads/(.*)$" {
if ( !-e $request_filename ) {
rewrite "^(.*)/wp-content/uploads/(.*)$" "https://***.com/wp-content/uploads/$2" redirect;
}
}
location ~ "^(.*)/wp-content/cache/thumb/(.*)$" {
if ( !-e $request_filename ) {
rewrite "^(.*)/wp-content/cache/thumb/(.*)$" "https://***.com/wp-content/cache/thumb/$2" redirect;
}
@serguk89
serguk89 / monorepo_from_monolit.sh
Created October 5, 2023 09:18
Creates a new monorepofrom multiple monolit repositories
#!/bin/sh
# Creates a new monorepo by fusing multiple repositories
# Child repositories that are going to be fused
CHILDREN="wp/theme/master plugins/gutenblocks/master wp/theme-core/master"
# Name of the created monorepo
MONOREPO="monorepo"
# Exit in case of any error
@serguk89
serguk89 / blade.xml
Created September 12, 2023 00:11 — forked from ryanemitchell/blade.xml
Sage Blade Directives for PHPStorm - place in projects .idea folder and restart the IDE
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="BladeInjectionConfiguration" default="false">
<directives>
<!-- Sage Directives - WordPress - https://log1x.github.io/sage-directives-docs/usage/wordpress.html-->
<data directive="@query" injection="true" prefix="(" suffix=")"/>
<data directive="@posts" injection="true" prefix="(" suffix=")"/>
<data directive="@hasposts" injection="true" prefix="(" suffix=")"/>
<data directive="@noposts" injection="true" prefix="(" suffix=")"/>
<data directive="@titl"/>
@serguk89
serguk89 / tickets.php
Created September 10, 2023 09:42 — forked from imath/tickets.php
Using WP Statuses for custom Post Types.
<?php
/**
* Using WP Statuses for custom Post Types.
*
* @link http://github.com/imath/wp-statuses
*/
// Exit if accessed directly.
defined( 'ABSPATH' ) || exit;
@serguk89
serguk89 / ACF Gutenberg get block fields
Created August 21, 2023 10:42 — forked from jenssogaard/ACF Gutenberg get block fields
Helper class for ACF and Gutenberg. Get blocks fields by passing block_id and post_id.
<?php
namespace JensSogaard;
class BlockHelper
{
/**
* Gets ACF fields for a specific block on a given post
* @author Jens Soegaard <jens@jenssogaard.com>
*/
public function getBlockFromPage(string $block_id, int $post_id)
@serguk89
serguk89 / boxstarter.ps1
Created June 29, 2021 13:05 — forked from ElJefeDSecurIT/boxstarter.ps1
Boxstarter Commands for a new Windows box.
# Description: Boxstarter Script
# Author: ElJefeDSecurIT
# Last Updated: 2017-10-10
#
# Install boxstarter:
# . { iwr -useb http://boxstarter.org/bootstrapper.ps1 } | iex; get-boxstarter -Force
#
# You might need to set: Set-ExecutionPolicy RemoteSigned
#
# Run this boxstarter by calling the following from an **elevated** command-prompt:
@serguk89
serguk89 / clean.sh
Created June 16, 2021 04:02 — forked from Iman/clean.sh
Free up disk space on Ubuntu - clean log, cache, archive packages/apt archives, orphaned packages, old kernel and remove the trash
#!/bin/sh
#Check the Drive Space Used by Cached Files
du -sh /var/cache/apt/archives
#Clean all the log file
#for logs in `find /var/log -type f`; do > $logs; done
logs=`find /var/log -type f`
for i in $logs
@serguk89
serguk89 / func.php
Created January 21, 2021 06:20
Добавление новых разделителей Yoast SEO
function add_new_separator( $separators ) {
$separators_new = [
'sc-flore' => '✿',
'sc-air' => '✈',
'sc-drive' => '✇',
'sc-skull' => '☠',
'sc-anchor' => '⚓',
'sc-circle-star' => '✯',
'sc-gier' => '⚙',
@serguk89
serguk89 / git.alias.sh
Created December 24, 2020 22:19
Aliases for Git
#---------------------------------------------------------------------------------------
# Aliases for Git
#---------------------------------------------------------------------------------------
alias gc="git clone"
alias gcm="git commit -m"
alias gco="git checkout"
alias grv='git remote -v'
alias gba="git branch -a"
alias gwait="git reset HEAD"
alias gundo="git reset --soft HEAD^"
@serguk89
serguk89 / Windows Defender Exclusions for Developer.ps1
Last active December 24, 2020 20:55 — forked from nerzhulart/Windows Defender Exclusions for Developer.ps1
Adds Windows Defender exclusions for developers (Visual Studio, JetBrains Rider, IntellIJ Idea, Git, MsBuild, dotnet, mono etc.)
$userPath = $env:USERPROFILE
$pathExclusions = New-Object System.Collections.ArrayList
$processExclusions = New-Object System.Collections.ArrayList
$pathExclusions.Add('C:\Windows\Microsoft.NET') > $null
$pathExclusions.Add('C:\Windows\assembly') > $null
$pathExclusions.Add($userPath + '\AppData\Local\Microsoft\VisualStudio') > $null
$pathExclusions.Add('C:\ProgramData\Microsoft\VisualStudio\Packages') > $null
$pathExclusions.Add('C:\Program Files (x86)\MSBuild') > $null
$pathExclusions.Add('C:\Program Files (x86)\Microsoft Visual Studio 14.0') > $null