Skip to content

Instantly share code, notes, and snippets.

View czachor's full-sized avatar

czachor

View GitHub Profile
@czachor
czachor / . Wordpress security
Last active October 24, 2022 13:48
Wordpress security
Wordpress security
@czachor
czachor / ublock-fb-reels-block
Last active August 10, 2022 11:29
uBlock: Block Facebook reels, stories and rooms.
! version 2022-08-01
www.facebook.com##.sbcfpzgs.stjgntxs.ni8dbmo4.k4urcfbm.nwvqtn77.fbipl8qg.m5lcvass.io0zqebd.hybvsw6c.du4w35lb.l9j0dhe7.rq0escxv > .ni8dbmo4.stjgntxs
facebook.com##[role="feed"]>div:has-text(/^(Reels and short videos)/)
facebook.com##[role=feed]>div [href="/reel/?s=ifu_see_more"]:upward([role=feed]>div)
facebook.com##div[role="tablist"]:upward(4)
@czachor
czachor / ProductCategory.php
Created May 28, 2021 15:14 — forked from treetop1500/ProductCategory.php
Sortable Drag and Drop Entities with Symfony and HTML5
<?php
namespace Common\ContentBundle\Entity;
...
use Gedmo\Mapping\Annotation as Gedmo;
class ProductCategory
{
...
/**
* @var integer $position
@czachor
czachor / Prevent double submits
Created November 16, 2020 13:51
Prevent double submits with javascript - HTML forms
document.querySelectorAll('form').forEach(form => {
form.addEventListener('submit', (e) => {
// Prevent if already submitting
if (form.classList.contains('is-submitting')) {
e.preventDefault();
}
// Add class to hook our visual indicator on
form.classList.add('is-submitting');
});
@czachor
czachor / LastBusinessDay.php
Last active June 22, 2020 20:30
PHP: get last business day
<?php
/**
* @param bool $with_today
* @return DateTime Last business day
*/
function lastBusinessDay($with_today = false): DateTime
{
$date = new DateTime();
if (!$with_today) {
@czachor
czachor / wp_usermeta.md
Last active June 30, 2021 08:24 — forked from magnific0/wp_usermeta.md
Show and Edit User Meta in Wordpress

Show and Edit User Meta in WordPress (works with UltimateMember)

Description

This simple procedure will allow you to:

  1. Display user meta fields under in the user list as additional columns (Users > All Users).
  2. Display these fields on user profiles.
  3. Edit these fields under user edit.

This method works completely without plugins and involves just some functions and hooks in functions.php. Plugins like "User Meta Display" achieve this to some level, but treat custom meta fiedlds completely different from the regular fields. They are shown and edited in seperate environment and fail to show the meta data is a table list. This method integrates custom user meta along with regular user (meta).