Skip to content

Instantly share code, notes, and snippets.

View yratof's full-sized avatar
🍊
Eating an orange

Andrew yratof

🍊
Eating an orange
View GitHub Profile
<?php
/**
* Optimize WooCommerce Scripts
* Remove WooCommerce Generator tag, styles, and scripts from non WooCommerce pages.
*/
add_action( 'wp_enqueue_scripts', 'child_manage_woocommerce_styles', 99 );
function child_manage_woocommerce_styles() {
//remove generator meta tag
remove_action( 'wp_head', array( $GLOBALS['woocommerce'], 'generator' ) );
@yratof
yratof / scripts.js
Created December 20, 2013 15:48
RoyalJs
// IE8 ployfill for GetComputed Style (for Responsive Script below)
if (!window.getComputedStyle) {
window.getComputedStyle = function(el) {
this.el = el;
this.getPropertyValue = function(prop) {
var re = /(\-([a-z]){1})/g;
if (prop === 'float') {prop = 'styleFloat';}
if (re.test(prop)) {
prop = prop.replace(re, function () {
return arguments[2].toUpperCase();
@yratof
yratof / gist:8314209
Created January 8, 2014 09:43
Messed up.
ة҈҈҈͟͟͟͞͞͞҉҉҉͢͢͢͡͡͡҈҈҈͜͜͜͝͝͝҉҉҉͟͟͟͠͠͠҈҈҈͟͟͟͠͠͠҉҉҉͢͢͢͡͡͡҈҈҈͜͜͜͝͝͝҉҉҉͟͟͟͠͠͠҈҈҈͜͜͜͝͝͝҉҉҉͢͢͢͡͡͡҈҈҈͟͟͟͞͞͞҈҈҈͟͟͟͠͠͠҉҉҉͢͢͢͠͠͠҉҉҉͜͜͜͝͝͝҈҈҈͟͟͟͟͠͠͠͠͠͠ة҈҈҈͟͟͟͞͞͞҉҉҉͢͢͢͡͡͡҈҈҈͜͜͜͝͝͝҉҉҉͟͟͟͠͠͠҈҈҈͟͟͟͠͠͠҉҉҉͢͢͢͡͡͡҈҈҈͜͜͜͝͝͝҉҉҉͟͟͟͠͠͠҈҈҈͜͜͜͝͝͝҉҉҉͢͢͢͡͡͡҈҈҈͟͟͟͞͞͞҈҈҈͟͟͟͠͠͠҉҉҉͢͢͢͠͠͠҉҉҉͜͜͜͝͝͝҈҈҈͟͟͟͟͠͠͠͠͠͠⇋░░⃝҉҉҉҉҉҉҉҉҉҉҉҉҉҉҉҉҉҉░҉░҉░҉҉҉҉҉҉҉҉҉҉҉⃝⬚⃝҉̟҉̟҉̟҉̟҉̟҉̟҉̟҉̟҉̟      ⇋░░⃝҉҉҉҉҉҉҉҉҉҉҉҉҉҉҉҉҉҉▒▓▓⃣҉͇҉͇҉͇҉͇҉͇҉͇҉͇҉͇҉͇҉҉̟҉̟҉̟҉̟҉̟҉̟҉̟҉̟҉̟░░҉҉فͤ҈ͥ҉ͦ҈ͧ҉ͨ҈ͩ҉ͪ҈ͫ҉ͬ҈ͭ҉ͮ҈ͯ҉ͨ҈ͬ҉ͧ҈ͥ҉ͦ҈ͧ҉ͨ҈ͩ҉ͪ҈ͫ҉ͬ҈ͭ҉ͮ҈ͯ҉ͨ҈ͬ҉ͧ҈ͨ҈ͧ͏͏͏͏͏͏͏͏͏͏͏͏͏͏͏͏͏͏͏͏͏͏͏͏͏͏͏͏͏͏͏͏͏͏͏͏͏͏͏͏͏͏͏͏͏͏͏҉ͯ҈ͮ҉ͭ҈ͤ҉ͦ҈ͥ҉ͧ҈ͩ҉ͭ҈ͨ҉ͣ҈ͪ҉ͧ҈ͭ҉ͩ҈فͤ҈ͥ҉ͦ҈ͧ҉ͨ҈ͩ҉ͪ҈ͫ҉ͬ҈ͭ҉ͮ҈ͯ҉ͨ҈ͬ҉ͧ҈ͥ҉ͦ҈ͧ҉ͨ҈ͩ҉ͪ҈ͫ҉ͬ҈ͭ҉ͮ҈ͯ҉ͨ҈ͬ҉ͧ҈ͨ҈ͧ͏͏͏͏͏͏͏͏͏͏͏͏͏͏͏͏͏͏͏͏͏͏͏͏͏͏͏͏͏͏͏͏͏͏͏͏͏͏͏͏͏͏͏͏͏͏͏҉ͯ҈ͮ҉ͭ҈ͤ҉ͦ҈ͥ҉ͧ҈ͩ҉ͭ҈ͨ҉ͣ҈ͪ҉ͧ҈ͭ҉ͩ҈ة҈҈҈͟͟͟͞͞͞҉҉҉͢͢͢͡͡͡҈҈҈͜͜͜͝͝͝҉҉҉͟͟͟͠͠͠҈҈҈͟͟͟͠͠͠҉҉҉͢͢͢͡͡͡҈҈҈͜͜͜͝͝͝҉҉҉͟͟͟͠͠͠҈҈҈͜͜͜͝͝͝҉҉҉͢͢͢͡͡͡҈҈҈͟͟͟͞͞͞҈҈҈͟͟͟͠͠͠҉҉҉͢͢͢͠͠͠҉҉҉͜͜͜͝͝͝҈҈҈͟͟͟͟͠͠͠͠͠͠ة҈҈҈͟͟͟͞͞͞҉҉҉͢͢͢͡͡͡҈҈҈͜͜͜͝͝͝҉҉҉͟͟͟͠͠͠҈҈҈͟͟͟͠͠͠҉҉҉͢͢͢͡͡͡҈҈҈͜͜͜͝͝͝҉҉҉͟͟͟͠͠͠҈҈҈͜͜͜͝͝͝҉҉҉͢͢͢͡͡͡҈҈҈͟͟͟͞͞͞҈҈҈͟͟͟͠͠͠҉҉҉͢͢͢͠͠͠҉҉҉͜͜͜͝͝͝҈҈҈͟͟͟͟͠͠͠͠͠͠ة҈҈҈͟͟͟͞͞͞҉҉҉͢͢͢͡͡͡҈҈҈͜͜͜͝͝͝҉҉҉͟͟͟͠͠͠҈҈҈͟͟͟͠͠͠҉҉҉͢͢͢
@yratof
yratof / functions.php
Last active January 2, 2016 14:19
Function to add class to body depending on font-size
<script>
// Check if localStorage is supported
if ('localStorage' in window && typeof localStorage == 'object') {
jQuery(document).ready(function($) {
// Set the class if black-white is set
// Note that localStorage saves everything as strings
if (localStorage["black-white"] == "1") {
$('html').addClass('black-white');
}
@yratof
yratof / header.php
Last active January 2, 2016 14:48
add class to body on click.
<span class="font-size" href="#">Font Size</span>
<span class="black-white" href="#">Black and White</span >
<script src="<?php bloginfo('template_url'); ?>/library/js/libs/cooked.js"></script>
<script>
jQuery(document).ready(function($){
// Check (onLoad) if the cookie is there and set the class if it is
if ($.cookie('font-size') == "yes") {$("body").addClass("font-size");}
if ($.cookie('black-white') == "yes") { $("body").addClass("black-white");}
@yratof
yratof / gist:8725886
Created January 31, 2014 02:58
digit_ping
/* HC-SR04 Sensor
https://www.dealextreme.com/p/hc-sr04-ultrasonic-sensor-distance-measuring-module-133696
This sketch reads a HC-SR04 ultrasonic rangefinder and returns the
distance to the closest object in range. To do this, it sends a pulse
to the sensor to initiate a reading, then listens for a pulse
to return. The length of the returning pulse is proportional to
the distance of the object from the sensor.
The circuit:
<?php
$taxonomy = 'category';
// get the term IDs assigned to post.
$post_terms = wp_get_object_terms( $post->ID, $taxonomy, array( 'fields' => 'ids' ) );
// separator between links
$separator = ', ';
if ( !empty( $post_terms ) && !is_wp_error( $post_terms ) ) {
@yratof
yratof / gist:9690234
Created March 21, 2014 16:35
Replace SVG with PNG
function supportsSVG() {
return !! document.createElementNS && !! document.createElementNS('http://www.w3.org/2000/svg','svg').createSVGRect;
}
if (!supportsSVG()) {
var imgs = document.getElementsByTagName('img');
var dotSVG = /.*\.svg$/;
for (var i = 0; i !== imgs.length; ++i) {
if(imgs[i].src.match(dotSVG)) {
imgs[i].src = imgs[i].src.slice(0, -8) + 'png';
}
@yratof
yratof / timing.scss
Created April 3, 2014 14:02
Animation timings from Bourbon
// CSS cubic-bezier timing functions. Timing functions courtesy of jquery.easie (github.com/jaukia/easie)
// Timing functions are the same as demo'ed here: http://jqueryui.com/demos/effect/easing.html
// EASE IN
$ease-in-quad: cubic-bezier(0.550, 0.085, 0.680, 0.530);
$ease-in-cubic: cubic-bezier(0.550, 0.055, 0.675, 0.190);
$ease-in-quart: cubic-bezier(0.895, 0.030, 0.685, 0.220);
$ease-in-quint: cubic-bezier(0.755, 0.050, 0.855, 0.060);
$ease-in-sine: cubic-bezier(0.470, 0.000, 0.745, 0.715);
$ease-in-expo: cubic-bezier(0.950, 0.050, 0.795, 0.035);
@yratof
yratof / index.html
Last active August 29, 2015 13:58
Off-canvas navigation
<div id="container">
<div class="sidebar_left ">
<a href="#" class="close mobile-only">X</a>
<div class="inner-div">
Content Goes Here
</div>
</div>
<div class="sidebar_right mobile-only">
<a href="#" class="close mobile-only">X</a>
<div class="inner-div">