This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Añade el campo NIF a la página de checkout de WooCommerce | |
*/ | |
add_action( 'woocommerce_before_checkout_billing_form', 'agrega_mi_campo_personalizado' ); | |
function agrega_mi_campo_personalizado( $checkout ) { | |
woocommerce_form_field( 'nif', array( | |
'type' => 'text', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <SPI.h> | |
#include <WiFi101.h> | |
char ssid[] = "myNetwork"; // your network SSID (name) | |
char pass[] = "myPassword"; // your network password | |
int keyIndex = 0; // your network key Index number (needed only for WEP) | |
int status = WL_IDLE_STATUS; | |
const char server[] = "example.com"; // name address for Google (using DNS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: WooCommerce NIF | |
* Description: Adds NIF fields to WooCommerce | |
* Version: 1.0 | |
* Author: Daniel Pereyra Costas | |
* Author URI: https://charrua.es | |
* License: GPL v2 or later | |
* License URI: https://www.gnu.org/licenses/gpl-2.0.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[program:app1-laravel-worker] | |
process_name=%(program_name)s_%(process_num)02d | |
command=<your-php-path> <your-artisan-path> queue:work --tries=3 | |
autostart=true | |
autorestart=true | |
numprocs=2 | |
redirect_stderr=true | |
stdout_logfile=<your-logfile-path> | |
[program:app2-laravel-worker] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
TXTDEST="/home/<username>/mysqlbackup/dblist.txt" | |
BKPDEST="/home/<username>/mysqlbackup" | |
PLESK="/usr/sbin/plesk" | |
DATEYMD=`date +"%Y-%m-%d"` | |
# Create Lockfile | |
LOCKFILE=/tmp/myBkup.lock | |
if [ -f $LOCKFILE ]; then | |
echo "Lockfile $LOCKFILE exists, exiting!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This function removes emoji from string | |
* Used to filter Twilio SMS/MMS for emoji characters and send messages using GSM instead of UCS-2 | |
* | |
* Usage remove_emoji('Lorem ipsum 🥊dolor 🤒sit amet, consectetur adipiscing 🍂 elit. 🌰🍁🌿🌾🌼🌻'); | |
*/ | |
function remove_emoji($text){ | |
return preg_replace('/[\x{1F3F4}](?:\x{E0067}\x{E0062}\x{E0077}\x{E006C}\x{E0073}\x{E007F})|[\x{1F3F4}](?:\x{E0067}\x{E0062}\x{E0073}\x{E0063}\x{E0074}\x{E007F})|[\x{1F3F4}](?:\x{E0067}\x{E0062}\x{E0065}\x{E006E}\x{E0067}\x{E007F})|[\x{1F3F4}](?:\x{200D}\x{2620}\x{FE0F})|[\x{1F3F3}](?:\x{FE0F}\x{200D}\x{1F308})|[\x{0023}\x{002A}\x{0030}\x{0031}\x{0032}\x{0033}\x{0034}\x{0035}\x{0036}\x{0037}\x{0038}\x{0039}](?:\x{FE0F}\x{20E3})|[\x{1F441}](?:\x{FE0F}\x{200D}\x{1F5E8}\x{FE0F})|[\x{1F468}\x{1F469}](?:\x{200D}\x{1F467}\x{200D}\x{1F467})|[\x{1F468}\x{1F469}](?:\x{200D}\x{1F467}\x{200D}\x{1F466})|[\x{1F468}\x{1F469}](?:\x{200D}\x{1F467})|[\x{1F468}\x{1F469}](?:\x{200D}\x{1F466}\x{200D}\x{1F466})|[\x{1F468}\x{1F469}](?:\x{200D}\x{1F466})|[\ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Require Weight field (WooCommerce) | |
Plugin URI: https://charrua.es | |
Description: Make weight field required when adding/editing product. Usefull when using weight shipping. | |
Author: Daniel Pereyra Costas | |
Author URI: https://charrua.es | |
Version: 0.1 | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Please add this to your functions.php | |
/** | |
* This snippet adds Blog page Gutenberg content before the posts grid on Astra theme if you are using a static homepage. | |
* | |
* First create a page for displaying posts, for example "Blog", add any Gutenberg block. | |
* Then on settings assign a static frontpage and the created "Blog" page to blog posts. | |
* | |
* You can now add any block content to the "Blog" page and it will be shown before the posts loop. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
gform.addAction( 'gform_input_change', function( elem, formId, fieldId ) { | |
if ( fieldId == 13 ) { | |
valorCampoDate = elem.value; | |
var parts = valorCampoDate.split( '/' ); | |
// Presta atención al mes ( parts[1] ); JavaScript cuenta los meses desde 0: | |
// Enero - 0, Febrero - 1, etc. | |
var myDate = new Date( parts[2], parts[1] - 1, parts[0] ); | |
// Cambiar el valor del campo oculto. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Restrict permission on WooCommerce REST API based on user_login and request type | |
* Let 'daniel' access ONLY to products data | |
*/ | |
add_filter( 'woocommerce_rest_check_permissions', 'charrua_allow_only_products', 10, 4 ); | |
function charrua_allow_only_products( $permission, $context, $object_id, $type ) { |
OlderNewer