Skip to content

Instantly share code, notes, and snippets.

View fidlerryan's full-sized avatar

Ryan Fidler fidlerryan

View GitHub Profile
var webAuth = new auth0.WebAuth({
domain: 'REDACTED',
clientID: 'REDACTED',
responseType: 'token',
redirectUri: REDACTED
});
webAuth.checkSession( {}, function( err, authResult ){
// err if automatic parseHash fails
if( err ){
$nullDate = $db->quote( $db->getNullDate() );
$nowDate = $db->quote( Factory::getDate()->toSql() );
$query
->andWhere(
[
$db->quoteName( 'a.publish_up' ) . ' = ' . $nullDate,
$db->quoteName( 'a.publish_up' ) . ' IS NULL',
$db->quoteName( 'a.publish_up' ) . ' <= ' . $nowDate
]
.overlay{
background-cover: cover;
background-image: linear-gradient(black, black), url(/path/to/background/image.jpg);
background-repeat: no-repeat;
background-blend-mode: saturation;
clip-path: polygon(0 0, 100% 0%, 100% 85%, 50% 100%, 0% 85%);
}
.overlay::before{
background-image: linear-gradient(76deg, rgba(0, 179, 255, 0.49), rgba(209, 255, 0, 0.73) 98%);
// check if ResizeObserver is supported
if( 'ResizeObserver' in window ){
var figcaption = document.querySelector( 'figcaption > h1.entry-title' );
var figure = document.querySelector( 'figure > div.post-thumbnail' );
// check if the elements exist
if( ( typeof( figcaption ) !== 'undefined' && figcaption !== null ) &&
( typeof( figure ) !== 'undefined' && figure !== null ) ){
@fidlerryan
fidlerryan / gist:8849ad09afb0b76afb21d7eb9e4c33bf
Created September 5, 2020 11:37
CSS masks and blend modes
.fusion-imageframe{
-webkit-mask-image: url('assets/images/mask-right.svg');
-webkit-mask-repeat: no-repeat;
-webkit-mask-position: center right;
-webkit-mask-size: contain;
mask-image: url('assets/images/mask-right.svg');
mask-repeat: no-repeat;
mask-position: center right;
mask-size: contain;
background-color: rgba(var(--primary-color-rgb), 0.5);
@fidlerryan
fidlerryan / gist:ae01e335d7b8dce07ea2c262f1c40b5b
Created February 28, 2020 02:23
Joomla's Email Protection Script in an AJAX Response
azXhr.onload = function(){
if( azXhr.status === 200 ){
var azDirectory = document.getElementById( 'modazdirectory' );
// replace with the DOM with the results of the AJAX call
azDirectory.innerHTML = azXhr.responseText;
// look for embedded scripts within the HTML
var azEmailCloak = azDirectory.querySelectorAll( 'script' );
@fidlerryan
fidlerryan / gist:235c7361ce52313932560096c05fa43a
Created September 13, 2019 20:55
withInstanceId example
/**
* BLOCK: bmore-micromodal
*
* Registering a basic block with Gutenberg.
* Simple block, renders and saves the same content without any interactivity.
*/
// Import CSS.
import './style.scss';
import './editor.scss';
<article>
<figure>
<?php if ( has_post_thumbnail() ) { the_post_thumbnail('alm-thumbnail'); }?>
<figcaption>
<h2 class="entry-title">
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a>
</h2>
<p class="post-meta">
<span class="published"><?php the_time("F d, Y"); ?></span>
</p>
const menuPrimary = document.getElementById( 'menu-primary' );
const sentinelPrimary = document.querySelector( '.sentinel-primary' );
function handlerPrimary( entriesPrimary ){
entriesPrimary.forEach( function( entry ){
if( entry.isIntersecting ){
menuPrimary.classList.remove( 'sticky' );
} else {
menuPrimary.classList.add( 'sticky' );
}
});
@fidlerryan
fidlerryan / gist:033b793289f0ee669932e6ec28278ce3
Last active February 25, 2019 16:27
Joomla 2-uncategorised redirects
// Apache
RewriteCond %{QUERY_STRING} ^$
RewriteRule (^|/)2-uncategorised$ /404 [R=301,L]
// IIS
<rule name="Joomla! Uncategorised Rule" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAny">
<add input="{URL}" pattern="(^|/)2-uncategorised$" ignoreCase="false" />
</conditions>