Skip to content

Instantly share code, notes, and snippets.

View railmedia's full-sized avatar

Adrian Tudorache railmedia

View GitHub Profile
jQuery(window).on('load', function() {
jQuery(window).scrollTop(0);
});
jQuery(function(){
if (jQuery(window).scrollTop() > 0) {
jQuery('header.et-l--header .et_builder_inner_content').addClass('has_et_pb_sticky');
jQuery('header.et-l--header .et_builder_inner_content').find('.et_pb_section:first-child').attr('class', 'et_pb_section et_pb_section_0_tb_header et_pb_sticky_module et_pb_with_background et_section_regular et_pb_section--with-menu et_pb_sticky et_pb_sticky--top');
}
});
HTTP/1.1 403 Forbidden
Transfer-Encoding: chunked
Server: cloudflare
CF-RAY: 95f80ac2ee4ec20b-DUB
origin-agent-cluster: ?1
x-frame-options: SAMEORIGIN
Connection: close
permissions-policy: accelerometer=(),autoplay=(),browsing-topics=(),camera=(),clipboard-read=(),clipboard-write=(),geolocation=(),gyroscope=(),hid=(),interest-cohort=(),magnetometer=(),microphone=(),payment=(),publickey-credentials-get=(),screen-wake-lock=(),serial=(),sync-xhr=(),usb=()
@railmedia
railmedia / ai-generated-fct-posts-db.php
Created May 13, 2025 12:20
AI generated function to add posts to db
<?php
/**
* Imports an array of data as WordPress posts, including support for post metadata.
*
* This function takes a structured array of post data and attempts to insert
* each item as a new post in WordPress using wp_insert_post().
* It includes validation for required fields, handles basic post data,
* custom fields via the 'meta_input' parameter, and taxonomies via 'tax_input'.
* It provides detailed error reporting using WP_Error objects, adhering to
* WordPress coding standards and localization best practices.
@railmedia
railmedia / prevent-font-download
Created April 10, 2025 06:32
Prevent font download
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP:Origin} [COLOR=red]!^$|http(s)?://(www\.)?beispiel\.de$ [NC]
RewriteRule \.(woff|woff2|eot|ttf)$ - [NC,L]
RewriteCond %{HTTP_REFERER} !.
RewriteRule \.(woff|woff2|eot|ttf)$ - [F,NC,L]
Options -Indexes
</IfModule>
@railmedia
railmedia / resize-products
Last active April 2, 2025 08:32
Resize products
JS
(function($){
function resizeElements() {
let height = 0;
jQuery('.products li').each(function(idx, product){
if( jQuery(this).height() > height ) {
height = jQuery(this).height();
}
@railmedia
railmedia / htaccess
Created February 10, 2025 15:26
Redirect domains
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(?:www\.)remodelarecorporalacrevedia\.ro$ [NC]
RewriteRule ^ https://evabodyart.ro%{REQUEST_URI} [L,R=301]
@railmedia
railmedia / gist:416ad94e3f9cb6997e40ff4d4e8882e2
Last active February 7, 2025 07:41
simacarserrorlog.txt
07.02.2025 08:38:37
The remote server returned an error: (400) Bad Request.
07.02.2025 08:38:37
at System.Net.HttpWebRequest.GetResponse()
at SIM_ACARS.Form1.get_aircrafts(String vaCallsign, String vaPassword)
07.02.2025 08:38:37
System.Collections.ListDictionaryInternal
@railmedia
railmedia / woo-countries-dump.txt
Created November 27, 2024 07:57
WooCommerce dump of WC()->countries->countries
array(249) {
["AF"]=>
string(11) "Afghanistan"
["AX"]=>
string(14) "Åland Islands"
["AL"]=>
string(7) "Albania"
["DZ"]=>
string(7) "Algeria"
["AS"]=>
@railmedia
railmedia / add-percentage-fee-woo.php
Created November 18, 2024 09:31
Add percentage fee woocommerce
add_action('woocommerce_cart_calculate_fees', 'custom_percentage_shipping_fee');
function custom_percentage_shipping_fee() {
// Set your desired percentage here (e.g., 10%)
$percentage = 10;
// Only apply the fee if we're in the cart or checkout page
if (is_cart() || is_checkout()) {
$cart_total = WC()->cart->get_subtotal();
$shipping_fee = ($cart_total * $percentage) / 100;
WC()->cart->add_fee('Percentage-based Shipping', $shipping_fee);