Skip to content

Instantly share code, notes, and snippets.

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

guillermo gtamborero

🏠
Working from home
View GitHub Profile
@cliffordp
cliffordp / functions.php
Last active September 23, 2023 06:22
Automatically login a single WordPress user upon arrival to a specific page.
<?php
/**
* Automatically login a single WordPress user upon arrival to a specific page.
*
* Redirect to home page once logged in and prevent viewing of the login page.
* Compatible with WordPress 3.9.1+
* Updated 2014-07-18 to resolve WP_DEBUG notice: "get_userdatabylogin is deprecated since version 3.3! Use get_user_by('login') instead."
* Updated 2019-07-09 to reformat code, pass 2nd parameter to `do_action()`, and hook into priority 1.
*
@Digiover
Digiover / saotn-wpdb-optimizer.php
Last active June 7, 2023 08:35
Executes an OPTIMIZE TABLE statement on all WordPress MySQL database tables, for instance from within a plugin: https://www.saotn.org/optimize-wordpress-mysql-tables-cron/
/**
* Executes an OPTIMIZE TABLE statement on all WordPress database
* tables.
*/
public static function saotn_wpdb_optimizer() {
global $wpdb;
$tables = $wpdb->get_col( "SHOW TABLES" );
foreach ( $tables as $table ) {
$wpdb->query( "OPTIMIZE TABLE $table" );
}
@javilobo8
javilobo8 / download-file.js
Last active July 1, 2024 23:21
Download files with AJAX (axios)
axios({
url: 'http://localhost:5000/static/example.pdf',
method: 'GET',
responseType: 'blob', // important
}).then((response) => {
const url = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', 'file.pdf');
document.body.appendChild(link);
@gaearon
gaearon / index.html
Last active February 13, 2024 09:46
Multiple React components on a single HTML page
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Add React in One Minute</title>
</head>
<body>
<h2>Add React in One Minute</h2>
<p>This page demonstrates using React with no build tooling.</p>
@JeffAspen
JeffAspen / gist:eec107dce0313ea432e87c903480caa4
Last active June 26, 2024 23:57
Elementor Remove Font Awesome
/**
* https://docs.elementor.com/article/286-speed-up-a-slow-site
*
* Note: By default, Font Awesome icons will only load on the pages where you've used them, so FA won't load on pages that aren't using any Font Awesome icons. This brings faster performance and faster page speed to your site, which can benefit your SEO and your users' experience. Only the CSS and fonts of the icon family you actually use are loaded. So only dequeue Font Awesome if you truly plan to not use any Font Awesome icons at all. If you dequeue Font Awesome, the icons will no longer show on any of your pages
*
*/
// Elementor - Remove Font Awesome
add_action( 'elementor/frontend/after_register_styles',function() {
foreach( [ 'solid', 'regular', 'brands' ] as $style ) {