Skip to content

Instantly share code, notes, and snippets.

View cdsaenz's full-sized avatar

charly cdsaenz

View GitHub Profile
@MrPunyapal
MrPunyapal / ExportCSV.php
Last active December 31, 2023 07:29
PHP Function to Export Products as CSV (without saving it in server)
<?php
function exportCSV()
{
header('Content-type: text/csv');
header('Content-Disposition: attachment; filename=products.csv');
header('Pragma: no-cache');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Expires: 0');
@ParthaDhar
ParthaDhar / changephp.sh
Last active April 25, 2024 17:37 — forked from qadirpervez/changephp.sh
change php version in cli and for apache
## Switch php version php-cli and in apache
echo
echo -e "\033[1;31m PHP Version changer Switcher\e[0m"
echo
echo -e "\033[0;33m PHP version currently active in your '/cli': \033[0;35m`sudo php -v | head -n 1 | cut -c 1-10` \e[0m" # Checking running php version
sudo sudo service apache2 stop &>- # Stopping lampp stack if running
echo
echo -e "\033[0;31m versions that you have installed:\e[0m"
ls -ldt /etc/php/* | awk '{print $9}'
echo
@dannanelli
dannanelli / Multiple-Service-Schema.jsonld
Last active February 29, 2024 14:33
Multiple Service Schema Example Template for Local SEO
<script type="application/ld+json">
{
"@context": "https://schema.org/",
"@type": "Service",
"serviceType": "{{SERVICE TYPE}}",
"provider": {
"@type": "LocalBusiness",
"name": "{{BUSINESS NAME}}"
},
"areaServed": {
@charafmrah
charafmrah / loading-spinner.css
Last active February 12, 2023 03:24
Animated loading spinner
.spinner {
border: 4px solid #f3f3f3;
border-top: 4px solid #3498db;
border-radius: 50%;
width: 50px;
height: 50px;
animation: spin 0.8s linear infinite;
}
@keyframes spin {
@Niq1982
Niq1982 / card.php
Last active April 9, 2024 17:00
Load more to WordPress blog archive using AlpineJS and Axios
<div class="card">
<?php if ($args['link']) : ?>
<a href="<?php echo esc_url($args['link']); ?>" class="global-link">
</a>
<?php endif; ?>
<div class="card-image">
<?php wp_get_attachment_image($args['image']); ?>
</div>
<?php
/**
* Proptotype
*/
namespace DoggieRescue\Notices;
class AdminNotice {
public static function process_messages() {
$notice = self::get_admin_message();
if ( ! empty( $notice ) && is_array( $notice ) ) {
@iosifnicolae2
iosifnicolae2 / index.html
Last active April 15, 2024 02:26
Whatsapp Floating Button
<a href="https://wa.me/40123456789?text=hi" style="
position: fixed;
width: 60px;
height: 60px;
bottom: 32px;
right: 33px;
background-color: #25d366;
color: #FFF;
border-radius: 50px;
text-align: center;
@rosswintle
rosswintle / build.php
Last active February 8, 2024 20:34
A VERY simple PHP static HTML generator that does a single-level extend, and includes with variable passing and that's about it.
<?php
/*
* Input: files matching src/pages/*.html
* Output: public/*.html
*
* Pages can extend a template by calling:
*
* extend(string $relativeTemplatePath, array $variables)
*
* at the start and:
@dartrax
dartrax / functions.php
Last active February 26, 2024 12:18
Translate WooCommerce mails into order language with TranslatePress before sending. Note: As of TranslatePress Version 2.3.5, this functionality was implemented natively by TranslatePress, making this Code obsolete. Read more here: https://translatepress.com/docs/translating-woocommerce-emails/
// Save the current language in post_meta when checkout is processed (used to identify correct Email language)
add_action('woocommerce_checkout_update_order_meta', 'dartrax_save_language_on_checkout', 10, 2 );
function dartrax_save_language_on_checkout( $order_id, $posted ) {
if( ! class_exists('TRP_Translate_Press') ) return '';
global $TRP_LANGUAGE;
update_post_meta( $order_id, 'order_language', $TRP_LANGUAGE );
}
// Woocommerce Shipment Mails
add_action( 'woocommerce_order_status_processing_to_cancelled_notification','dartrax_prepare_locale_for_Mail_with_order_id', 5, 1 );
@GAS85
GAS85 / http2_apache2_ubuntu20.04.md
Last active April 19, 2024 18:11
How to Enable HTTP/2 in Apache 2.4 on Ubuntu 20.04

Based on https://gist.github.com/GAS85/8dadbcb3c9a7ecbcb6705530c1252831

Requirements

  • A self-managed VPS or dedicated server with Ubuntu 20.04 running Apache 2.4.xx.
  • A registered domain name with working HTTPS (TLS/SSL). HTTP/2 only works alongside HTTPS because most browsers, including Firefox and Chrome, don’t support HTTP/2 in cleartext (non-TLS) mode.

Step 1: Install Apache2

Per default it will be apache2 version 2.4.41 what is enought for http2 support.