Skip to content

Instantly share code, notes, and snippets.

Shaun RubiousShaun

Block or report user

Report or block RubiousShaun

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
View AR quicklook.htm
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
<title>AR Quick Look Example</title>
<script>
/* from Apple's AR Quick Look Gallery */
(function () {
var isRelAR = false;
var a = document.createElement('a');
if (a.relList.supports('ar')) {
View MapBox Static.php
return "<img width='$width' height='$height' src='https://api.mapbox.com/styles/v1/mapbox/streets-v10/static/$lnglat,9.67,0.00,0.00/{$width}x{$height}@2x?access_token=$mapboxkey'>";
View IntersectionObserver.js
// IntersectionObserver
// Used with Rubious plugin and lazy load images
var images = document.querySelectorAll('[data-lazy-src]');
var config = {
rootMargin: '0px 0px 400px 0px',
threshold: 0 };
var loaded = 0;
View Intersection Observer.txt
// Include intersection-observer-polyfill.js for older browsers
// https://github.com/w3c/IntersectionObserver/tree/master/polyfill
// JS:
// Get scroll direction
var lastScrollTop = 0, delta = 5;
var lastScrollDirection = null;
$(window).scroll(function(event){
View Scaling website.scss
// Need to add "frontend" class to the site - this is to prevent this stuff happening on the WYSIWYG editor
html.frontend {
@media only screen and (min-width: 1920px) { // Correct size for large screens
font-size: 62.5%;
}
@media only screen and (max-width: 1289px) { // Slightly larger size for small screens
font-size: 0.6vw;
}
View disable-css-grid.scss
// To easily view how a site looks when CSS Grid is not available, use this in the SASS file.
// First you need this variable:
$cssgrid: "(grid-template-rows:initial)";
// Then you can uncomment the below to re-declare the variable and so disable the @supports for every browser:
// $cssgrid: "(display:no-css-grid-support)";
// Wrap every usage of CSS Grid in this:
@supports(#{$cssgrid}) {
@RubiousShaun
RubiousShaun / php-block.js
Created Aug 3, 2018 — forked from pento/php-block.js
Converting a shortcode to a block
View php-block.js
// License: GPLv2+
var el = wp.element.createElement,
registerBlockType = wp.blocks.registerBlockType,
ServerSideRender = wp.components.ServerSideRender,
TextControl = wp.components.TextControl,
InspectorControls = wp.editor.InspectorControls;
/*
* Here's where we register the block in JavaScript.
@RubiousShaun
RubiousShaun / Holiday Messages
Created Jun 14, 2017
Holiday Messages for Rubious plugin
View Holiday Messages
<?php
/* ==========================================================================
Holiday Message Hooks
============================================================================= */
if(function_exists('holiday_messages')) {
View Customise multiupload field gravity forms
// PHP:
add_filter( 'gform_file_upload_markup', 'change_upload_markup', 10, 4 );
function change_upload_markup( $file_upload_markup, $file_info, $form_id, $field_id ) {
return '<strong>' . esc_html( $file_info['uploaded_filename'] ) . "</strong > <img class='gform_delete' src='" . GFCommon::get_base_url() . "/images/delete.png' onclick='gformDeleteUploadedFile({$form_id}, {$id}, this);' />";
}
// JS:
View Open Graph for WooCommerce Category pages
<?php
/**
* Filters default image arguments for TSF.
*
* @param array $defaults The image defaults.
* @param array $args The image callback arguments.
*/
add_filter( 'the_seo_framework_og_image_args', function( $defaults, $args = array() ) {
You can’t perform that action at this time.