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
  • 15:48 (UTC +02:00)
View GitHub Profile
@gdarko
gdarko / dgv-loop-videos.php
Created February 19, 2024 17:28
Query uploaded videos
<?php
// Loop videos
$database = new WP_DGV_Db_Helper();
$videos = $database->get_videos([
'author' => 'USER_ID_GOES_HERE',
'posts_per_page' => 5,
'paged' => 1,
]);
@gdarko
gdarko / functions.php
Created February 19, 2024 17:21
WPForms after upload hook.
<?php
/**
* Saves uploaded video through WPForms to current user meta.
*
* @param $hook_data
*
* What $hook_data contains:
*
* $hook_data = array(
#!/usr/bin/env bash
#
# This is a script that can automatically
# setup DOMjudge server & judgehost, inside a same server.
#
# you can leave it by its default value
USERNAME=domjudge
USER_PASSWORD=domjudge
@gdarko
gdarko / dgv-create-post-type-entry.php
Last active September 18, 2023 00:15
Vimeify (Video Uploads for VImeo) - Creates post type entry on front-end upload
<?php
add_action('dgv_frontend_after_upload', function($data){
/**
* Example of the $data array:
* $data = array(
* 'vimeo_title' => $vimeo_title,
* 'vimeo_description' => $vimeo_description,
* 'vimeo_id' => $vimeo_id,
@gdarko
gdarko / motion_switch_light.yaml
Last active September 24, 2023 20:53 — forked from Ultra9k/motion_switch_light.yaml
This is a blueprint based on the original motion_light from Home Assistant. This one, however, allows you to control not only lights but also switches when motion is detected.
blueprint:
name: Motion-activated Switch and/or Light
description: Turn on a switch and/or light when motion is detected.
domain: automation
source_url: https://darkog.com/blog/home-assistant-motion-lights-with-switches/
input:
motion_entity:
name: Motion Sensor
selector:
entity:
@gdarko
gdarko / dlm-restapi-disable-software.php
Created May 23, 2023 06:55
Simple plugin to disable the software parameter in the REST API activate endpoint when using Digital License Manager Pro
<?php
/**
* Plugin Name: DLM Disable Software from REST API
* Description: Sample plugin that disables software requirement for software parameter in activate endpoint in the rest api.
* Author: Darko Gjorgjijoski
* Version: 1.0.0
* License: GPLv2 or later
*/
@gdarko
gdarko / dlm-emails-move-licenses-ontop.php
Last active March 22, 2023 09:21
Move the licenses table above order details in the WooCommerce order email. Simply drop this in your plugins (or mu-plugins) directory or even add the snippet in your functions.php starting from line 13.
<?php
/**
* Plugin Name: DLM Emails Move Licenses On-Top
* Description: Move the licenses table above order details in the WooCommerce order email
* Author: Darko Gjorgjijoski
* Version: 1.0.0
* License: GPLv2 or later
*/
if ( ! defined( 'ABSPATH' ) ) {
@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 February 13, 2023 01:19
Add order id to the Vimeo title field on a GravityForms / WPForms based forms in the WooCommerce's order-received page
<?php
/**
* [WPForms]
* Prepopulate the order id in the WPForms on the order thank you page.
*
* @param $value
* @param $field
* @param $form
*