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
  • 17:21 (UTC +02:00)
View GitHub Profile
@gdarko
gdarko / dlm-product-defaults.php
Created February 5, 2023 00:46
Simple plugin that sets Digital License Manager defaults when you publish a new products. To install this, drop it in mu-plugins or plugins dir.
<?php
/**
* Plugin Name: DLM Product Defaults
* Description: Sample plugin that sets product defaults when you publish a product for a first time or create via Woo APIs.
* Author: Darko Gjorgjijoski
* Version: 1.0.0
* License: GPLv2 or later
*/
@gdarko
gdarko / wp-config.php
Created February 3, 2023 16:55
Enable debug log in WordPress
<?php
// Something else...
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_DISPLAY', false );
define( 'WP_DEBUG_LOG', true );
// something else...
@gdarko
gdarko / functions.php
Last active June 23, 2022 21:02
Using WP Vimeo Videos PRO upload modal in your applications
<?php
/**
* Enqueue upload modal
*/
function dgv_823828_enqueue_scripts() {
if(is_page(1111)) { // check by page or perhaps other condition to avoid enqueuing the script globally.
wp_enqueue_style('dgv-upload-modal');
wp_enqueue_script('dgv-upload-modal');
wp_enqueue_script('your-custom-script', 'https://url-to-script/script.js', array('jquery', 'dgv-upload-modal'), null, true);
@gdarko
gdarko / unzip_download.php
Last active May 2, 2022 18:42
Unzip php file
<?php
set_time_limit(0);
function unzipFile( $file, $dir = null ) {
if ( is_null( $dir ) ) {
$dir = dirname( __FILE__ );
}
$dir = $dir . DIRECTORY_SEPARATOR . 'unzipped';
@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 / 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/