Skip to content

Instantly share code, notes, and snippets.

View karlazz's full-sized avatar

Karla Leibowitz karlazz

  • herself
  • Walnut Creek, CA
View GitHub Profile
@karlazz
karlazz / gist:7168bbb8360ff1cfece8dfc55b206f14
Created September 2, 2020 21:42
haruki murakami deep world
What we see before us is just one tiny part of the world.  We get into the habit of thinking, this is the world, but that's not true at all.  The real world is a much darker and deeper place than this, and much of it is occupied by jellyfish and things.  -- Haruki Murakami
@karlazz
karlazz / snapshot a div with html2canvas
Created November 14, 2019 20:51
snapshot a div with html2canvas, with some application specific controls for a google map
function snapshotDiv(snapdiv, snapdest, scale) {
// requires html2canvas
var spinnerDiv = document.createElement("div");
var spinner = document.body.appendChild(spinnerDiv);
$('#snapControl').hide();
$(snapdiv + ' .gm-bundled-control').hide();
$('#hideGoogleUICB').trigger('submit');
/* Move yoast meta box to bottom of pages */
add_filter( 'wpseo_metabox_prio', function() { return 'low'; } );
@karlazz
karlazz / gist:b883bc479a5dbea77f3078232d227e37
Created August 14, 2019 16:33
change text strings for anything in events calendar using gettext
//https://support.theeventscalendar.com/178892-Change-the-wording-of-any-bit-of-text-or-string
function tribe_custom_theme_text ( $translation, $text, $domain ) {
// Put your custom text here in a key => value pair
// Example: 'Text you want to change' => 'This is what it will be changed to'
// The text you want to change is the key, and it is case-sensitive
// The text you want to change it to is the value
// You can freely add or remove key => values, but make sure to separate them with a comma
// This example changes the label "Venue" to "Location", and "Related Events" to "Similar Events"
$custom_text = array(
@karlazz
karlazz / GutenbergSCdemo
Last active August 6, 2019 17:37
Gutenberg shortcode demo code
add_shortcode( 'gutenberg_test', 'send_request' ); // for testing
function send_request() {
trace('GB test underway');
$value=rand(10,100);
return 'I ran';
}
//* add a trace file
$upload_dir = wp_upload_dir();
@karlazz
karlazz / remove dashboard widgets
Created July 17, 2019 17:04
remove dashboard widgets
// https://deluxeblogtips.com/remove-dashboard-widgets-in-wordpress/
add_action('admin_init', 'rw_remove_dashboard_widgets');
function rw_remove_dashboard_widgets() {
remove_meta_box('dashboard_right_now', 'dashboard', 'normal'); // right now
remove_meta_box('dashboard_recent_comments', 'dashboard', 'normal'); // recent comments
remove_meta_box('dashboard_incoming_links', 'dashboard', 'normal'); // incoming links
remove_meta_box('dashboard_plugins', 'dashboard', 'normal'); // plugins
remove_meta_box('dashboard_quick_press', 'dashboard', 'normal'); // quick press
remove_meta_box('dashboard_recent_drafts', 'dashboard', 'normal'); // recent drafts
function showLocation(position) {
window.location.href ="http://YOURDOMAINHERE/events/map/?action=tribe_list&tribe_paged=1&tribe-bar-geoloc-lat="+ position.coords.latitude +"&tribe-bar-geoloc-lng="+ position.coords.longitude;
}
function errorHandler(err) {
if(err.code == 1) {
alert("Error: Access is denied!");
}else if( err.code == 2) {
alert("Error: Position is unavailable!");
}
#table-container {
overflow-y: scroll;
height: 100vh; /* or whatever */
}
#table th {
position: sticky;
position: -webkit-sticky; /* for Safari */
top: 0;
}
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js" type="text/javascript"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.js" type="text/javascript"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js" type="text/javascript"></script>
<script src="html2canvas.min.js" type="text/javascript"></script>
<style>
/* Set the size of the div element that contains the map */
function convertasbinaryimage() {
html2canvas(document.getElementById("map"), {
useCORS: true,
onrendered: function (canvas) {
var img = canvas.toDataURL("image/png");
img = img.replace('data:image/png;base64,', '');
var finalImageSrc = 'data:image/png;base64,' + img;
$('#googlemapbinary').attr('src', finalImageSrc);
}
});