Skip to content

Instantly share code, notes, and snippets.

@bacoords
bacoords / bb-popup-example.js
Created February 18, 2019 18:30
sample bb magnific popup code
$('.cb-drawerfolio a').filter(function () {
return /\.(png|jpg|jpeg|gif)(\?.*)?$/i.test(this.href);
}).magnificPopup({
closeBtnInside: false,
type: 'image',
gallery: {
enabled: true
}
});
@bacoords
bacoords / scrub-smart-quotes.php
Created February 21, 2019 21:35
Replaces smart quotes with quotation marks when adding shortcodes to WordPress content
/**
* Scrubs content for curly quotes
* @param string $content
* @return string
*/
function prefix_scrub_smart_quotes_from_shortcodes( $content ){
// Search for all smartquotes inside of shortcodes and replace them
$content = preg_replace('/(“|”)(?=[^\[]*\])/', '"', $content );
@bacoords
bacoords / wp.jquery.default.js
Created July 2, 2019 20:45
Just a default wrapper
(function($) {
// Any generic functions can go here...
$(document).ready(function($){
// Anything that needs to wait for the document to be ready goes here
});
@bacoords
bacoords / canonical-functions.php
Created August 19, 2020 16:44
c3 yoast canonical fix
/**
* Removes any test urls from Yoast links.
*
* @param [type] $link
* @return void
*/
function c3_fix_yoast_canonical_items( $link ) {
return str_replace(
array(
'c3dti.ai',
if (
( $_SERVER['HTTP_HOST'] == 'c3.live' )
) {
$newurl = 'https://c3.ai/live/';
header('HTTP/1.0 301 Moved Permanently');
header("Location: $newurl");
exit();
}
<ion-list *ngIf="(videoCategories$ | async) as categories" class="ion-padding-start">
<ion-item (click)="getSelectedCategoryVideos('2380')">
Therapeutic Breakout Sessions
</ion-item>
<ion-item (click)="getSelectedCategoryVideos('2374')">
Online Breakout Sessions
</ion-item>
<ion-item *ngFor="let category of categories" (click)="getSelectedCategoryVideos(category.id)">
{{ category.name }}
@bacoords
bacoords / replace-images.js
Created October 13, 2020 03:58
public - function to load large images
// Function to background load images and swap out their source.
function replaceImageSrc() {
jQuery('svg image').each(function(){
var el = jQuery(this);
// Get the new href.
var href = el.attr('xlink:href');
href = href.replace( 'assets_small', 'assets_large' );
href = href.replace( '-s.', '-l.' );
@bacoords
bacoords / public-listener-example.js
Last active October 23, 2020 19:09
Setting up function for 'onload' more properly
function addClickEvents() {
//events added here to ensure all image elements fully loaded prior to adding events
d3.select("#poster-image") //Extinction Rebellion
.on("mouseover", function() { showExcerpt("xr", 450, 125, "R", 500, 500, boxText); })
.on("mouseout", function() {hideExcerpt("xr");})
.on("click", showContrib);
d3.select("#blockUpperText3") //Robin Wall Kimmerer

Underscores Tutorial

howarddc.com | 2.25.2021

Tutorial

Dev Prereqs

The first step is to confirm that your machine is ready for development using Node, NPM, and Gulp.

  • NVM: Node Version Manager can be confirmed by running command -v nvm.
  • Gulp CLI should be installed globally via npm install --global gulp-cli. You can confirm it by running gulp --version.
@bacoords
bacoords / understrap-child-allow-dropdown-links.php
Created March 18, 2021 22:20
All dropdown to be links when using the bootstrap nav walked or under strap theme.