Skip to content

Instantly share code, notes, and snippets.

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

Jasper Frumau jasperf

🏠
Working from home
View GitHub Profile
@jasperf
jasperf / access_from_web.md
Created July 5, 2014 08:28
MySQL Commands to create users, database, password and grant necessary privileges from the command line
mysql> CREATE USER 'user_name'@'localhost' IDENTIFIED BY 'password';
mysql> GRANT ALL PRIVILEGES ON database_name.* TO 'user_name'@'localhost' WITH GRANT OPTION;
mysql> CREATE USER 'user_name'@'%' IDENTIFIED BY 'password';

mysql> GRANT ALL PRIVILEGES ON database_name.* TO 'user_name'@'%' WITH GRANT OPTION;

@jasperf
jasperf / woocommerce_defer_transactional_emails.php
Created November 15, 2023 03:55 — forked from jessepearson/woocommerce_defer_transactional_emails.php
This will turn on deferred transactional emails in WooCommerce. This may help if you are experiencing slow checkouts or checkout timeouts.
<?php // Do not copy this line
/**
* This will turn on deferred transactional emails in WooCommerce. This may help if you
* are experiencing slow checkouts or checkout timeouts.
*/
add_filter( 'woocommerce_defer_transactional_emails', '__return_true' );
@jasperf
jasperf / wp-config.php
Last active November 15, 2023 02:35 — forked from JRyven/wp-config.php
WordPress Debugging Options
// general PHP and WordPress warnings, error messages and status information
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
define( 'WPS_DEBUG', true );
// script and style
define( 'WPS_DEBUG_SCRIPTS', true );
@jasperf
jasperf / color-palette-addition-acf-color-picker.php
Last active January 7, 2023 03:09 — forked from simplethemes/scripts.php
Customize the ACF color picker in your theme and have it load colors of your liking as swatches
<?php
/**
* Add brand color palette to acf color picker
* https://www.advancedcustomfields.com/resources/javascript-api/#filters-color_picker_args
*
*/
function kronos_acf_input_admin_footer() {
?>
<script type="text/javascript">
@jasperf
jasperf / index.html
Created January 3, 2023 01:55 — forked from ypn/index.html
Lazy Loading background images in CSS
<div id="container">
<h3>Lazy loading CSS background images</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam at ligula non lorem facilisis finibus. Suspendisse turpis lacus, tempus sit amet dignissim sit amet, pretium non sem. Ut malesuada purus ac magna placerat, tempus commodo turpis consectetur. Nunc vitae metus vehicula nunc congue varius. Suspendisse egestas urna non finibus feugiat. Vestibulum maximus, nunc et tempus convallis, dui ante vestibulum est, in lobortis purus sapien eget lacus. Suspendisse cursus enim non quam mollis imperdiet. Pellentesque convallis eget nunc vitae fringilla. Fusce interdum, velit semper varius aliquet, eros sapien facilisis erat, iaculis vulputate erat arcu vel neque. Suspendisse dignissim hendrerit lorem. Etiam metus ex, finibus vitae iaculis vitae, iaculis non ex. Phasellus commodo id ante id consequat. Nunc consectetur viverra lacus non fringilla. Pellentesque nec nisl vulputate, sagittis nisl id, venenatis nisi. Nunc malesuada tellus a elit s
<?php
/**
* Add login and logout links to main menu
*
* @param string $items The HTML list content for the menu items.
* @param obj $args An object containing wp_nav_menu() arguments.
*
* @link https://codex.wordpress.org/Function_Reference/wp_login_url
* @link https://codex.wordpress.org/Function_Reference/wp_logout_url
* @link https://developer.wordpress.org/reference/functions/wp_nav_menu/
@jasperf
jasperf / functions.php
Created February 8, 2020 00:02 — forked from hirejordansmith/functions.php
Add support for ACF custom fields to WooCommerce Attributes
<?php
// Adds a custom rule type.
add_filter( 'acf/location/rule_types', function( $choices ){
$choices[ __("Other",'acf') ]['wc_prod_attr'] = 'WC Product Attribute';
return $choices;
} );
// Adds custom rule values.
add_filter( 'acf/location/rule_values/wc_prod_attr', function( $choices ){
@jasperf
jasperf / clear_gravity_form_default_values.js
Created September 25, 2022 08:26 — forked from BronsonQuick/clear_gravity_form_default_values.js
Clear default values in Gravity Forms and place them back in on blur if they are empty
jQuery(document).ready(function($) {
jQuery.fn.cleardefault = function() {
return this.focus(function() {
if( this.value == this.defaultValue ) {
this.value = "";
}
}).blur(function() {
if( !this.value.length ) {
this.value = this.defaultValue;
@jasperf
jasperf / find-base64-occurences
Created September 21, 2022 11:38 — forked from anotheremily/find-base64-occurences
hackers seem to like base64 encoding their php commands
#!/bin/bash
find . -name "*.php" -exec grep "base64" '{}' \; -print &> b64-detections.txt
find . -name "*.php" -exec grep "eval" '{}' \; -print &> eval-detections.txt
@jasperf
jasperf / cf7.css
Last active June 9, 2022 09:34 — forked from codehandling/cf7.css
Contact Form 7 Styles for basic CSS styling of the form. Form is responsive and has nice rounded corners. For labels and placeholders you need to edit the form in CF7 https://imwz.io/contact-form-7-css-boilerplate/
/*
** Contact Form 7 basics
**
**/
/* Form width and border */
.wpcf7 {
text-align: left;
width: 90%;