Skip to content

Instantly share code, notes, and snippets.

View apsolut's full-sized avatar
🏠
Working from home

Aleksandar Perisic apsolut

🏠
Working from home
View GitHub Profile
@apsolut
apsolut / n8n.js
Created November 25, 2023 01:18
n8n
// repolace
{{ $json["jobs"]["location"]["workplace_type"].replace('on_site', 'onsite') }}
@apsolut
apsolut / hs-on-form-submit.js
Created September 28, 2023 08:43
HS onform submitt
$('.hs_cos_wrapper_type_form').on('hsvalidatedsubmit', '.hs-form', function (e) {
console.log( 'check check' );
});
window.addEventListener('message', function (event) {
if (event.data.type === 'hsFormCallback' && event.data.eventName === 'onFormSubmit') {
/* print to the console on submit, or add in custom redirect in here */
console.log('onFormSubmit');
}
});
@apsolut
apsolut / wp-filter-front-base.php
Created September 22, 2023 10:33
remove global front base of archive for your Custom Post Types
add_filter( 'register_post_type_args', function( $args, $post_type )
{
if( ('industries' === $post_type || 'success-stories' === $post_type || 'integrations-product' === $post_type ) && is_array( $args ) ) {
$args['rewrite']['with_front'] = false;
}
return $args;
}, 99, 2 );
@apsolut
apsolut / facetwp-group-posts.php
Last active September 4, 2024 17:42
FacetWP group posts by taxonomy name and filter with custom facetwp filters
<?php
/**
* based on https://gist.github.com/mgibbs189/63ce2faf110b9021ca68e16a50955fc4
& based on https://gist.facetwp.com/gist/gist-63ce2faf110b9021ca68e16a50955fc4
* Works with FacetWP
* Group things by taxonomy with taxonomy name before posts
* dont remove class names facet-wrap and facetwp-template
*/
<div class="facet-wrap">
@apsolut
apsolut / salesforce-phone-number-prefix.config
Created August 10, 2023 08:39
SF phone number alignment
SELECT Id, Phone,
CASE(
/* Check if phone number contains a country code */
IF(
REGEX(Phone, '^[+](.*)$'),
/* If phone number already contains country code, format it */
REGEX(
SUBSTITUTE(Phone, ' ', ''),
'[\\+]', '00'
),
@apsolut
apsolut / cog-accordion-data-bg.js
Created July 22, 2023 16:27
cognity accordion working but from data-bg - try to copy htm
// core version
import { gsap } from "gsap";
// Accordion for Task
// Helper function to get elements by class name and return the first match
function getElementByClassName(className) {
return document.querySelector('.' + className);
}
@apsolut
apsolut / accordion-gsap-flip.js
Created July 22, 2023 11:42
cognigy: js accordion
// core version
import { gsap } from "gsap";
import { Flip } from "gsap/flip";
gsap.registerPlugin(Flip);
// Accordion for Task
const groups = gsap.utils.toArray(".accordion-group");
groups.forEach(el => {
el.addEventListener("click", () => toggleMenu(el));
@apsolut
apsolut / apsolut-wordpress-cleaner-example.php
Created April 12, 2023 09:00
WordPress Auto Cleaner - Example to Delete Comments, Pages and create new Page
<?php
/**
* Delete pages
* @link https://developer.wordpress.org/reference/functions/wp_delete_post/
*/
function apsolut_delete_multiple_pages_from_plugin() {
// Set an array of page IDs to delete
$page_ids = array(1, 2, 3); // Hello World, Homepage, Privacy Policy
location ~* ^(/.+)\.(jpg|jpeg|jpe|png|gif)$ {
	add_header Vary Accept;

	if ($http_accept ~* "webp"){
		set $imwebp A;
	}
	if (-f $request_filename.webp) {
wsl -u root -e bash -c "apt-get upgrade -y >/dev/null"
wsl bash -c 'sudo usermod -aG docker $USER'
wsl bash -c 'echo CAROOT=$CAROOT'
wsl -u root mkcert -install
wsl -u root service docker start
if (-not(wsl -e docker ps)) {
throw "docker does not seem to be working inside the WSL2 distro yet. "
}
# If docker desktop was previously set up, the .docker can break normal use of docker client.