Skip to content

Instantly share code, notes, and snippets.

View serguk89's full-sized avatar

Serhii serguk89

  • Kyiv, Ukraine
View GitHub Profile
@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 / 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
@serguk89
serguk89 / debug-scroll.md
Created November 15, 2020 12:36 — forked from cuth/debug-scroll.md
Find the elements that are causing a horizontal scroll. Based on http://css-tricks.com/findingfixing-unintended-body-overflow/

Debug Horizontal Scroll

(function (d) {
    var w = d.documentElement.offsetWidth,
        t = d.createTreeWalker(d.body, NodeFilter.SHOW_ELEMENT),
        b;
    while (t.nextNode()) {
        b = t.currentNode.getBoundingClientRect();
 if (b.right &gt; w || b.left &lt; 0) {
@serguk89
serguk89 / import_files.php
Created October 8, 2020 06:21 — forked from teledirigido/import_files.php
Create post, add attachment and update field via ACF
<?php
/*
*
* This small scripts creates a post and attaches a file using Advanced custom field.
*
* Created by Miguel Garrido
* miguel.co.nz | miguel@blacksheepdesign.co.nz
*
* Notes:
@serguk89
serguk89 / php-block.js
Created April 29, 2020 19:15 — forked from pento/php-block.js
Converting a shortcode to a block: this method is fast to do, but a mediocre UX. You should only use this as a stopgap until you can implement a full block UI.
// License: GPLv2+
var el = wp.element.createElement,
registerBlockType = wp.blocks.registerBlockType,
ServerSideRender = wp.components.ServerSideRender,
TextControl = wp.components.TextControl,
InspectorControls = wp.editor.InspectorControls;
/*
* Here's where we register the block in JavaScript.
@serguk89
serguk89 / wds-hello-world.php
Created February 16, 2020 13:25 — forked from Oceas/wds-hello-world.php
WDS WP-CLI 101 Complete
<?php
/*
Plugin Name: WDS Hello World
Plugin URI: https://webdevstudios.com/
Description: Teaching the basics of WP-CLI
Author: Web Dev Studios
Version: 1.0.0
Author URI: https://webdevstudios.com/
*/
class WDS_CLI {