Skip to content

Instantly share code, notes, and snippets.

View apsolut's full-sized avatar
🎯
Focusing

Aleksandar Perisic apsolut

🎯
Focusing
View GitHub Profile
@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.
@apsolut
apsolut / plesk-nginx
Created December 29, 2022 09:29
Additional nginx directives Plesk
location ~* ^(/.+)\.(jpg|jpeg|jpe|png|gif)$ {
add_header Vary Accept;
if ($http_accept ~* "webp"){
set $imwebp A;
}
if (-f $request_filename.webp) {
set $imwebp "${imwebp}B";
}
if ($imwebp = AB) {
@apsolut
apsolut / wpengine-environment.php
Last active September 4, 2024 17:51
WPEngine
<?php
// Sites:
$production_name='INSTALL_PRD';
$staging_name='INSTALL_STG';
$development_name='INSTALL_DEV';
// Check if PWP_NAME is set
if (defined('PWP_NAME')) {
@apsolut
apsolut / .gitignore
Created September 13, 2022 14:23
gitignore starter
# all files
node_modules/
hubspot.config.yaml
.DS_Store
# editors
.vscode
.idea
.env
.env.*
*.psd
@apsolut
apsolut / wp_get_environment_type.php
Last active September 4, 2024 17:52
wp_get_environment_type
<?php
/**
*
* @URL https://developer.wordpress.org/reference/functions/wp_get_environment_type/
* define( 'WP_ENVIRONMENT_TYPE', 'local' );
* for each environment put it to wp-config
*
/