Skip to content

Instantly share code, notes, and snippets.

💾
Gettin ma tech awn

Mark Hewitt yayMark

💾
Gettin ma tech awn
  • Perth, Western Australia
Block or report user

Report or block yayMark

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@yayMark
yayMark / gist:f00d590e0d5a50b080a39a22bab46a4f
Created Jul 9, 2016 — forked from corsonr/gist:3d0425deaa80c601d454
WooCommerce: custom variations settings
View gist:f00d590e0d5a50b080a39a22bab46a4f
<?php
// Add Variation Settings
add_action( 'woocommerce_product_after_variable_attributes', 'variation_settings_fields', 10, 3 );
// Save Variation Settings
add_action( 'woocommerce_save_product_variation', 'save_variation_settings_fields', 10, 2 );
/**
* Create new fields for variations
@yayMark
yayMark / wc25.php
Created Jul 10, 2016 — forked from corsonr/wc25.php
WooCommerce 2.5+: add new variations settings
View wc25.php
<?php
// Add New Variation Settings
add_filter( 'woocommerce_available_variation', 'load_variation_settings_fields' );
/**
* Add custom fields for variations
*
*/
function load_variation_settings_fields( $variations ) {
@yayMark
yayMark / wc25.php
Created Jul 10, 2016 — forked from corsonr/wc25.php
WooCommerce 2.5+: display custom variation fields
View wc25.php
<div class="woocommerce-variation-custom-text-field">
{{{ data.variation.text_field }}}
</div>
@yayMark
yayMark / gist:47ece2c583dcabaedbfd7e72a26b799a
Created Jul 14, 2017
Delete a specific cookie using JavaScript in the URL field of a bookmark
View gist:47ece2c583dcabaedbfd7e72a26b799a
javascript:document.cookie="cookieNameGoesHere=; max-age=-1; path=/;";console.log("Popup cookie removed");
@yayMark
yayMark / animationend.js
Created Nov 24, 2017
Applying styling to a button contained within a translucent parent div on a CSS animation end. Applied a stronger background colour instead!
View animationend.js
var newsArticles = document.querySelectorAll('.desktop .newspanel .news-article');
for (var i = 0; i < newsArticles.length; i++) {
(function() {
var element = newsArticles[i];
element.addEventListener('animationend', function() {
var style = window.getComputedStyle(element);
var opacity = style.getPropertyValue('opacity');
var selector = '.desktop .btn';
var button = element.querySelector(selector);
if (opacity == 0.9) {
@yayMark
yayMark / beatport.sh
Created Dec 1, 2017
In Google Chrome on Mac OS, open an app style window with a site of choice with the profile of choice
View beatport.sh
#!/bin/bash
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --app=http://mixes.beatport.com/dj/deepspacehouse/43 --profile-directory="Profile 1"
@yayMark
yayMark / epoch_to_date.js
Last active Dec 3, 2017
Convert unix epoch to a date time string
View epoch_to_date.js
var args = process.argv.slice(2);
var epoch = Number(args[0]);
// you can use seconds or milliseconds
var length = args[0].toString().length;
if (length <= 10) {
epoch = epoch * 1000;
}
var myDate = new Date(epoch);
@yayMark
yayMark / bad_encode_to_html_entity.sql
Created Dec 6, 2017
WordPress: find and replace badly encoded characters with HTML encoded versions
View bad_encode_to_html_entity.sql
update wp_posts set post_content = replace(post_content,'“','&ldquo;');
update wp_posts set `post_excerpt` = replace(post_excerpt,'“','&ldquo;');
update wp_postmeta set meta_value = replace(meta_value,'“','&ldquo;');
update wp_posts set post_content = replace(post_content,'’','&rsquo;');
update wp_posts set post_excerpt = replace(post_excerpt,'’','&rsquo;');
update wp_postmeta set meta_value = replace(meta_value,'’','&rsquo;');
update wp_posts set post_content = replace(post_content,'–','&mdash;');
update wp_posts set `post_excerpt` = replace(post_excerpt,'–','&mdash;');
@yayMark
yayMark / apply_style_in_iframe.js
Created Dec 6, 2017
jQuery: Apply styling to an element inside and iframe. Will only work if the iframe is on the same domain as the parent.
View apply_style_in_iframe.js
$("iframe.html5anim").load( function() {
$("iframe.html5anim").contents().find("head")
.append($("<style type='text/css'>#canvas{background-color:red!important;}</style>"));
});
@yayMark
yayMark / iframe_call.js
Created Dec 6, 2017
JavaScript: call a function inside an iframe from the parent
View iframe_call.js
document.getElementById("woop").contentWindow.init()
You can’t perform that action at this time.