Skip to content

Instantly share code, notes, and snippets.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@hisnipes
hisnipes / GoogleSpreadsheet_SavePDF_EmailAuto.js
Created February 5, 2014 21:10
Google Apps Script: Using custom menu, save Google Spreadsheet as PDF with custom options (landscape/portrait, gridlines) in Google Drive and automatically email PDF as attachment to multiple recipients. Credit: produced in conjunction with Victor W. Yee.
// Create custom menu within Spreadsheet
function onOpen() {
var submenu = [{name:"Save and Email PDF", functionName:"spreadsheetToPDF"}];
SpreadsheetApp.getActiveSpreadsheet().addMenu('Admin Functions', submenu);
}
// Start spreadsheetToPDF function
function spreadsheetToPDF(key) {
// Authentication stuff
@hisnipes
hisnipes / WP_OverrideParentThemeFunc.php
Last active July 22, 2017 07:17
The correct way to override a Wordpress parent theme function in functions.php through a child theme.
<?php
#-----------------------------------------------------------------#
# Example: load revised tinymce file in child theme folder
#-----------------------------------------------------------------#
add_action( 'after_setup_theme', 'new_function_setup' );
function new_function_setup() {
remove_action('init', 'old_function_init');
@hisnipes
hisnipes / Wordpress GravityForms Google Spreadsheet Hook
Last active December 10, 2021 14:03
Wordpress GravityForms Google Spreadsheet Hook - dynamically populate radio button choices using data from a Google Spreadsheet (should allow for easier collaboration with non-tech colleagues). Matches with today's date to pull relevant information from the table. Thanks to Pamela Fox (parsing JSON output with PHP: https://gist.github.com/pamela…
<?
// Gravity Form Hook to SQL Database for Today's Dishes //
// the ### in gform_pre_render_### locates the id of your form //
add_filter('gform_pre_render_5', 'todays_dishes');
function todays_dishes($form){
foreach($form['fields'] as &$field){