Skip to content

Instantly share code, notes, and snippets.

View duplaja's full-sized avatar

Dan D. duplaja

  • Central US
View GitHub Profile
@duplaja
duplaja / wp-privacy.php
Created January 12, 2017 17:57 — forked from mattyrob/wp-privacy.php
Stop WordPress auto-updates and control information shared with api.wordpress.org
<?php
// you'll have to put a plugin header here
// Stop auto updated in WordPress 3.7+
add_filter( 'auto_update_core', '__return_false' );
add_filter( 'auto_update_plugin', '__return_false' );
add_filter( 'auto_update_theme', '__return_false' );
add_filter( 'auto_update_translation', '__return_false' );
// stop translation updates when updating plugins or themes
@duplaja
duplaja / convert-guest-to-logged-in.php
Last active May 22, 2019 02:56
Convert Guest Orders to Logged In
<?php
//Runs on User Registration
add_action( 'user_register', 'wc_map_guest_initial_match_past_orders', 10, 1 );
function wc_map_guestinitial_match_past_orders( $user_id ) {
//Get current users's e-mail from ID
$current_user = get_user_by( 'ID', $user_id );
$email = $current_user->user_email;
@duplaja
duplaja / get-field-value-last-entry.php
Last active May 22, 2019 02:50
Get last Gravity Forms Entry Value
<?php
//Form ID
$form_id = 1;
//Field ID
$field_id = 1;
//Pulls only the most recent entry
$paging = array( 'offset' => 0, 'page_size' => 1 );
@duplaja
duplaja / Encrypt_Decrypt_WP_Options.php
Last active May 22, 2019 02:43
Encrypt / Decrypt WP Options on Save (API keys, etc)
<?php
//Registers the pre_update_option filter for elements to encrypt. Format pre_update_option_(option name)
//Only do this for ones you want encrypted... in this case, first and third options.
function yourplugin_init() {
add_filter( 'pre_update_option_your_first_option', 'yourplugin_update_option', 10, 2 );
add_filter( 'pre_update_option_your_third_option', 'yourplugin_update_option', 10, 2 );
}
add_action( 'init', 'yourplugin_init' );
@duplaja
duplaja / csv-to-html-searchable-and-sortable-table.markdown
Created June 22, 2018 00:36
CSV to HTML Searchable and Sortable Table
@duplaja
duplaja / sweepstakes.php
Last active June 20, 2019 18:23
Sample sweepstakes for Gravity Forms
<?php
//Change gform_pre_submission_1 to gform_pre_submission_(your form # here)
add_action( 'gform_pre_submission_1', 'sweepstakes_winner_check' );
function sweepstakes_winner_check( $form ) {
//Array of codes for the first listed prize
$prize_one = array('aaaa','bbbb','cccc');
//Array of codes for second listed prize
@duplaja
duplaja / GravityFormsToggle.css
Last active July 18, 2019 00:39
Checkbox Toggle for Gravity Forms: Use Class .pt-toggle
.gform_wrapper .pt-toggle .gfield_checkbox input[type=checkbox] {
margin-left: -9999px;
position: absolute;
visibility: hidden;
}
.gform_wrapper .pt-toggle .gfield_checkbox input[type=checkbox] + label {
background-color: #ddd;
border-radius: 60px;
cursor: pointer;
display: block;
@duplaja
duplaja / allmusic-tamper-follow-fix.js
Created September 9, 2019 23:36
Allmusic.com Follow Artist Accessibility Fix (Tampermonkey Userscript)
// ==UserScript==
// @name Make Allmusic Accessible: Follow Artist
// @namespace http://tampermonkey.net/
// @version 1.0
// @description Makes the clickable div button to follow an artist accessible to screenreaders
// @author Dan Dulaney
// @match https://www.allmusic.com/artist/*
// @grant none
// ==/UserScript==
@duplaja
duplaja / core-blocks.txt
Created November 12, 2019 13:18 — forked from DavidPeralvarez/core-blocks.txt
Gutenberg core blocks list
// Útil para filtros de Gutenberg como "allowed_block_types"
archives
audio
button
categories
code
column
columns
coverImage
@duplaja
duplaja / notevalues.json
Created January 28, 2020 04:43 — forked from marcgg/notevalues.json
note frequency value
var noteValues = {
'C0': 16.35,
'C#0': 17.32,
'Db0': 17.32,
'D0': 18.35,
'D#0': 19.45,
'Eb0': 19.45,
'E0': 20.60,
'F0': 21.83,
'F#0': 23.12,