Skip to content

Instantly share code, notes, and snippets.

View sergeliatko's full-sized avatar
💭
Looking for talented PHP / JavaScript / WordPress developers. Apply now!

Serge Liatko sergeliatko

💭
Looking for talented PHP / JavaScript / WordPress developers. Apply now!
View GitHub Profile
@sergeliatko
sergeliatko / wp-comment-form-google-recaptcha.php
Last active July 6, 2019 12:55
Moves the Google reCAPTCHA notice after all fields before the submit button in WordPress comment form.
/**
* Move Google reCAPTCHA after the comment form fields and before the submit button.
*/
add_action( 'init', function () {
if (
has_action( 'comment_form_logged_in_after', 'gglcptch_commentform_display' )
|| has_action( 'comment_form_after_fields', 'gglcptch_commentform_display' )
) {
remove_action( 'comment_form_logged_in_after', 'gglcptch_commentform_display' );
remove_action( 'comment_form_after_fields', 'gglcptch_commentform_display' );
@sergeliatko
sergeliatko / url_mappings_wp_2_squarespace.sql
Created December 29, 2019 19:22
SQL query to grab URL mapping for Squarespace from WP when your blog posts are on site root.
SELECT CONCAT( '/', `post_name`, ' -> /blog/', `post_name`, ' 301' ) FROM `wp_posts` WHERE `post_type` = 'post' AND `post_status` = 'publish'
@sergeliatko
sergeliatko / wp-config.php
Created March 7, 2021 17:10
Debug and cron setup
// Enable WP_DEBUG mode
define( 'WP_DEBUG', true );
// Enable Debug logging to the /wp-content/debug.log file
define( 'WP_DEBUG_LOG', true );
// Disable display of errors and warnings
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );
@sergeliatko
sergeliatko / text-pre-formatter.php
Last active June 13, 2023 23:45
Php code to preformat raw text and cut it into chunks before sending to OpenAI API
<?php
/**
* Cleans a text string by normalizing line breaks, removing empty lines, and normalizing spaces.
*
* @param string $text The text string to be cleaned.
*
* @return string The cleaned text string.
*/
function clean_text( string $text ): string {
<?php
/**
* THIS IS AN EXAMPLE OF USAGE TAKEN AND MODIFIED FROM AN EXISTING PLUGIN
* ----- DO NOT USE THE CODE AS IS WITHOUT THINKING AND UNDERSTANDING WHAT IT DOES -----
*
* COMMENTS ARE ADDED TO HELP UNDERSTANDING THE APPROACH USED IN THE PLUGIN AND HOW TO WORK WITH WPSETTINGS
*/
namespace TechSpokes\TrackHospitalitySoftware;
<?php
/**
* Updated: 2023-08-25 15:58 CEST - fixed bugs in block recognition, improved logic.
*/
/**
* Cleans a text string by normalizing line breaks, removing empty lines, and normalizing spaces.
*
* @param string $text The text string to be cleaned.
*
@sergeliatko
sergeliatko / ppa-believe.json
Created April 12, 2024 18:30
Chunked Document Json - 67 seconds of precessing from raw text
{
"index": 0,
"title": "PRIVACY POLICY",
"name": "",
"content": "",
"type": "container",
"path": "000",
"children": [
{
"index": 0,
@sergeliatko
sergeliatko / ppa-believe.txt
Created April 12, 2024 18:33
PPA Believe Raw text (copied as is from PDF) - initially sent to processing as a whole file
Updated date: January 2021
PRIVACY POLICY
This Group Privacy Policy (“Privacy Policy”) concerns BELIEVE SAS, a French company, registered with
the Trade and Corporate Registry of Paris under the number 481 625 853, with its main office located
24 rue Toulouse Lautrec 75017 PARIS ("Believe SAS") and its subsidiaries around the World, including
TUNECORE, hereafter collectively referred to as "Believe”, "We", or "Us".
This Privacy Policy describes Believe's personal data processing practices for the digital distribution of
music, the supply of products ("Products") and services ("Service(s)"), in general or through our
websites and/or other electronic communications services (widgets, mobile applications or API),
collectively or individually "Site(s)"). Believe SAS acts as data controller and its subsidiaries as data
@sergeliatko
sergeliatko / ppa-believe-outline.txt
Created April 12, 2024 18:35
PPA Believe Outline (build by arrawy walk recursive on output JSON)
PRIVACY POLICY
Introduction and Overview of Privacy Policy
Identification of Data Controller and Scope of Privacy Policy.
Scope and Role Definitions in Data Processing for Digital Distribution and Services
Commitment to Secure Data Processing and Privacy Protection.
Acknowledgment and Agreement to Privacy Policy Terms by Users.
Declaration of Independence from Third-Party Privacy Policies and Liability Disclaimer.
Applicability of Privacy Policy to Various Stakeholders.
Restrictions on Minors' Subscription and Purchase Requirements Including Parental Consent.
Right to Amend Privacy Policy Under GDPR and Notification Procedures.
@sergeliatko
sergeliatko / input.txt
Created July 31, 2024 08:44
SIMANTIKS API Examples - Raw Text Input
20. Money Breaks (Union Proposal No. 19; Producers’ Proposal No. 9)
a. Looping. Retakes, Etc. (Union Proposal No. 19.A.)
Modify Section 58 of the Television Agreement as follows:
"The performer’s contract shall not include guarantees for looping, retakes, added scenes,
process transparencies, trick shots, trailers, changes or foreign versions (subject to
availability) outside the period of consecutive employment, except for Schedule F
performers and except that advance payment for looping, retakes, etc. is permitted as to
Schedule C performers whose salaries equal or exceed:
Program Length Per Episode or Program
V2 hour $5,000