Skip to content

Instantly share code, notes, and snippets.

View g3luka's full-sized avatar

Giovanni de Luca g3luka

View GitHub Profile
@g3luka
g3luka / app.js
Created October 8, 2024 02:57
WordPress Lambda Middleware Replace Domain
const axios = require("axios");
const WORDPRESS_ENDPOINT = process.env.WORDPRESS_ENDPOINT;
const REPLACE_DOMAIN_FROM = process.env.REPLACE_DOMAIN_FROM;
const REPLACE_DOMAIN_TO = process.env.REPLACE_DOMAIN_TO;
const CACHE_SECONDS_200 = process.env.CACHE_SECONDS_200 || 60 * 5; // 5 minutes
const CACHE_SECONDS_301 = process.env.CACHE_SECONDS_301 || 60 * 30; // 30 minutes
const CACHE_SECONDS_404 = process.env.CACHE_SECONDS_404 || 60 * 15; // 15 minutes
exports.handler = async (event) => {
@g3luka
g3luka / .platform__nginx__conf.d__elasticbeanstalk__wordpress.conf
Created June 20, 2020 01:07
WordPress Beanstalk Nginx Amazon Linux 2
location ~ ^(/[^/]+/)?files/(.+) {
try_files /wp-content/blogs.dir/$blogid/files/$2 /wp-includes/ms-files.php?file=$2 ;
access_log off; log_not_found off; expires max;
}
#avoid php readfile()
location ^~ /blogs.dir {
internal;
alias /var/app/current/wp-content/blogs.dir ;
access_log off; log_not_found off; expires max;
const imageLazyLoad = (element) => {
const src = element.getAttribute('data-src');
element.setAttribute('src', src);
element.removeAttribute('data-src');
}
const observador = new IntersectionObserver(function(entries) {
entries.forEach(function(entry) {
// if (entry.isIntersecting === true || entryintersectionRatio > 0) {
if (entry.isIntersecting !== true) return;
@g3luka
g3luka / index.html
Created April 2, 2020 16:23
Element sticky fixed
<p style="margin-bottom:100px;">Scroll this page.</p>
<div class="sticky"><h3>Super amazing header</h3></div>