Skip to content

Instantly share code, notes, and snippets.

View gdarko's full-sized avatar
Crunching code, one line at a time.

Darko Gjorgjijoski gdarko

Crunching code, one line at a time.
  • Self-employed
  • The Internet
  • 16:25 (UTC +02:00)
View GitHub Profile
@gdarko
gdarko / functions.php
Created February 18, 2022 21:50
Changes the default vimeo video page slug on WP Vimeo Videos plugin
<?php
/**
* Changes the default vimeo video page slug.
* @return string
*/
function dgv_post_type_slug() {
return 'videos';
}
add_filter('dgv_post_type_slug', 'dgv_post_type_slug');
# /etc/network/interfaces
# Loopback device:
auto lo
iface lo inet loopback
# device: ens18
auto ens18
iface ens18 inet static
address <additional IP>
netmask 255.255.255.255
@gdarko
gdarko / MkNumberFormatter.php
Last active January 4, 2022 19:40
PHP NumberFormatter with some corrections for Macedonian language
<?php
/**
* Class MkNumberFormatter
*/
class MkNumberFormatter extends NumberFormatter {
public function format( $num, $type = null ) {
$formatted = parent::format( $num, $type );
if ( 'mk' === $this->getLocale() ) {
@gdarko
gdarko / functions.php
Created June 1, 2021 21:25
WP Vimeo Videos - Modify video title before upload (both Vimeo.com and Local video title)
<?php
/**
* Append date to the video title stored in Media > Library
*
* @param $args
*
* @return mixed
*/
function dgv_before_create_local_video_params_823842831( $args ) {
@gdarko
gdarko / ip-location-block-example.php
Last active May 13, 2021 01:01
IP Location Block developer hooks examples
<?php
/**
* Samples/Snippets to extend functionality of IP Location Block
*
* @package IP_Location_Block
* @author tokkonopapa <tokkonopapa@yahoo.com>
* @license GPL-3.0
* @link https://iplocationblock.com/
* @copyright 2013-2019 tokkonopapa
*/
@gdarko
gdarko / ip-location-block-settings-performance.json
Created May 11, 2021 00:00
IP Location Block settings for performance measure.
{
"ip_geo_block_settings[version]": "3.0.0",
"ip_geo_block_settings[matching_rule]": "0",
"ip_geo_block_settings[white_list]": "JP",
"ip_geo_block_settings[black_list]": "ZZ",
"ip_geo_block_settings[extra_ips][white_list]": "192.0.64.0/18\n69.46.32.0/20",
"ip_geo_block_settings[extra_ips][black_list]": "",
"ip_geo_block_settings[signature]": "../,/wp-config.php,/passwd\ncurl,wget,eval,base64\nselect:.5,where:.5,union:.5\nload_file:.5,create:.6,password:.4",
"ip_geo_block_settings[response_code]": "403",
"ip_geo_block_settings[login_fails]": "5",
@gdarko
gdarko / drop-in-admin.php
Last active May 11, 2021 19:01
Drop-in for IP Location Block custom filters for admin
<?php
/**
* Drop-in for IP Location Block custom filters for admin
*
* This file should be named as `drop-in-admin.php`.
*
* @package IP_Location_Block
* @author darkog <dg@darkog.com>
* @license GPL-3.0
* @link https://iplocationblock.com/
@gdarko
gdarko / ip-location-block.php
Created May 10, 2021 23:51
IP Location Block Emergency
<?php
/**
* IP Location Block
*
* A WordPress plugin that blocks undesired access based on geolocation of IP address.
*
* @package IP_Location_Block
* @author Darko Gjorgjijoski <dg@darkog.com>
* @license GPL-3.0
* @link https://www.ipgeoblock.com/
@gdarko
gdarko / class-zcloudfront.php
Last active May 11, 2021 18:08
IP Location Block api class library for CloudFront
<?php
if ( class_exists( 'IP_Location_Block_API', false ) ) :
/**
* Class for CloudFront
*
* @see http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/georestrictions.html
* @see http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/RequestAndResponseBehaviorCustomOrigin.html#RequestCustomIPAddresses
* @see http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/RequestAndResponseBehaviorCustomOrigin.html#request-custom-headers-behavior
@gdarko
gdarko / class-zcloudflare.php
Last active May 11, 2021 18:03
IP Location Block API class library for CloudFlare
<?php
if ( class_exists( 'IP_Location_Block_API', false ) ) :
/**
* Class for CloudFlare
*
* @see https://support.cloudflare.com/hc/en-us/articles/200170986-How-does-CloudFlare-handle-HTTP-Request-headers-
* @see https://support.cloudflare.com/hc/en-us/articles/200170856-How-do-I-restore-original-visitor-IP-with-vBulletin-
* @see https://support.cloudflare.com/hc/en-us/articles/200168236-What-does-CloudFlare-IP-Geolocation-do-