Skip to content

Instantly share code, notes, and snippets.

View dbspringer's full-sized avatar

Derek Springer dbspringer

View GitHub Profile
@dbspringer
dbspringer / frontend.js
Last active August 29, 2015 14:20
JS for front-end plugin
(function($) {
$(document).ready( function() {
var file_frame; // variable for the wp.media file_frame
// attach a click event (or whatever you want) to some element on your page
$( '#frontend-button' ).on( 'click', function( event ) {
event.preventDefault();
// if the file_frame has already been created, just reuse it
@dbspringer
dbspringer / col2num.py
Created July 21, 2015 18:30
Python one-liner to convert spreadsheet column to zero-based index. e.g. 'A' -> 0, 'AA' -> 26, etc
col2num = lambda col: reduce(lambda x, y: x*26 + y, [ord(c.upper()) - ord('A') + 1 for c in col])-1
@dbspringer
dbspringer / force_jp_https.php
Created February 4, 2016 18:38
To force Jetpack to make API requests using HTTPS.
<?php
add_filter( 'jetpack_can_make_outbound_https', '__return_true', 99999 );