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 / security-checklist.md
Created April 12, 2025 17:29 — forked from mattppal/security-checklist.md
A simple security checklist for your vibe coded apps

Frontend Security

Security Measure Description
Use HTTPS everywhere Prevents basic eavesdropping and man-in-the-middle attacks
Input validation and sanitization Prevents XSS attacks by validating all user inputs
Don't store sensitive data in the browser No secrets in localStorage or client-side code
CSRF protection Implement anti-CSRF tokens for forms and state-changing requests
Never expose API keys in frontend API credentials should always remain server-side
@apsolut
apsolut / Category.html
Created December 17, 2024 13:31 — forked from moderatorwes/Category.html
Zendesk: Accordions for Copenhagen theme - Live example(https://zenultra.zendesk.com/)
<!-- Add this code if you would like accordions on your Category Page -->
<div class="container-divider"></div>
<div class="container">
<nav class="sub-nav">
{{breadcrumbs}}
{{search submit=false}}
</nav>

Sometimes, a customer might have data being loaded programmatically into a page and want that data to write to form fields. Because HubSpot Forms are generated programmatically with React, there need to be two considerations in your code that make setting fields programmatically more difficult:

  1. The data must be inserted after the form has finished loading
  2. Data that is inserted programmatically must have a js "change" event fired on the field in order to propagate the change into the React data layer

These two considerations are handled separately.

Inserting form data after form load

There are two methods to handle this - one including jQuery and one using vanilla javascript

@apsolut
apsolut / desc.php
Created April 24, 2022 20:53 — forked from igorbenic/desc.php
How to Programmatically Change Yoast SEO Open Graph Meta | http://www.ibenic.com/programmatically-change-yoast-seo-open-graph-meta
<?php
function change_yoast_seo_og_meta() {
add_filter( 'wpseo_opengraph_desc', 'change_desc' );
}
function change_desc( $desc ) {
// This article is actually a landing page for an eBook
if( is_singular( 123 ) ) {
@apsolut
apsolut / update-product-prices.php
Created December 8, 2021 19:59 — forked from devinsays/update-product-prices.php
Updates product prices via WP CLI script.
<?php
/**
* Updates product prices.
* More about WP CLI scripts:
* https://wptheming.com/2021/05/wp-cli-scripts-and-woocommerce/
*
* wp eval-file update-product-prices.php
*/
$products = get_posts([
@apsolut
apsolut / fix-wsl2-dns-resolution
Created November 27, 2021 13:25 — forked from coltenkrauter/fix-wsl2-dns-resolution
Fix DNS resolution in WSL2
More recent resolution:
1. cd ~/../../etc (go to etc folder in WSL).
2. echo "[network]" | sudo tee wsl.conf (Create wsl.conf file and add the first line).
3. echo "generateResolvConf = false" | sudo tee -a wsl.conf (Append wsl.conf the next line).
4. wsl --terminate Debian (Terminate WSL in Windows cmd, in case is Ubuntu not Debian).
5. cd ~/../../etc (go to etc folder in WSL).
6. sudo rm -Rf resolv.conf (Delete the resolv.conf file).
7. In windows cmd, ps or terminal with the vpn connected do: Get-NetIPInterface or ipconfig /all for get the dns primary and
secondary.
@apsolut
apsolut / wp-query-efficiency-args.php
Created September 1, 2021 09:25 — forked from mishterk/wp-query-efficiency-args.php
Some handy considerations when running WP_Query to speed up the query depending on the requirements. This demonstrates using specific post ID's from ACF custom database tables in conjunction with some built in WP_Query args to save on internal queries.
<?php
$query = new WP_Query([
// Standard query args. Using post__in can be much faster. If searching ACF custom
// database tables data, plugin the found post IDs in here.
'post_type' => 'post',
'post__in' => [1,2,3], // array of post IDs
// Optional args to improve performance. Use these to cut down on internal
@apsolut
apsolut / change_link.php
Created March 12, 2021 15:50 — forked from igorbenic/change_link.php
Custom WordPress Rewrite Rule to Combine Taxonomy and Post Type | www.ibenic.com/custom-wordpress-rewrite-rule-combine-taxonomy-post-type
<?php
if(isset($_POST['login'])) {
if(!isset($_POST['g-recaptcha-response']) || empty($_POST['g-recaptcha-response'])) {
echo 'reCAPTHCA verification failed, please try again.';
} else {
$secret = 'google_secret_key';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://www.google.com/recaptcha/api/siteverify?secret='.$secret.'&response='.$_POST['g-recaptcha-response']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
@apsolut
apsolut / wp-query-ref.php
Created December 30, 2020 14:59 — forked from luetkemj/wp-query-ref.php
WP: Query $args
// This gist is now maintained on github at https://github.com/luetkemj/wp-query-ref
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.github.io
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/4.9.4/src/wp-includes/query.php
*/