Skip to content

Instantly share code, notes, and snippets.

View susanlangenes's full-sized avatar

Susan Langenes susanlangenes

  • Portland, Oregon, USA
View GitHub Profile
@susanlangenes
susanlangenes / pixelated-face.js
Created June 16, 2021 02:34
pixelated-face.js
const faceDetector = new window.FaceDetector();
const video = document.querySelector('video.webcam');
const canvas = document.querySelector('canvas.video');
const ctx = canvas.getContext('2d');
const faceCanvas = document.querySelector('canvas.face');
const faceCtx = faceCanvas.getContext('2d');
const SIZE = 10;
const SCALE = 1.2;
//write a function that will populate the user's video
@susanlangenes
susanlangenes / functions.php
Last active January 11, 2023 12:14
functions.php - snippets to make the Block Editor a true WYSIWYG
<?php
/**
* 'THEME' functions and definitions
*
* @link https://developer.wordpress.org/themes/basics/theme-functions/
*
* @package 'YOUR NAMESPACE HERE'
*/
@susanlangenes
susanlangenes / header.php
Created August 11, 2016 22:38
smoother way to get a specific image size's url (using ACF image ID). Note lines 62-64
<?php
/**
* The header for our theme.
*
* This is the template that displays all of the <head> section and everything up until <div id="content">
*
* @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
*
* @package Collage Creative Gallery 2016
*/
<?php
/**
* Template Name: Civi Form Page
*
* 1/3, 2/3 page template
*
* @package MRG Theme
*/
get_header(); ?>
@susanlangenes
susanlangenes / get-taxonomy-term-postcount.php
Created January 8, 2016 02:12
Display post count for a taxonomy term. Nice for archive templates.
<?php
// this will output like so: Taxonomy Term Name (19) <- where '19' is the number of posts with that taxo term.
?>
<h1 class="page-title">
<?php $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); echo $term->name; ?>
&nbsp;(<?php global $wp_query;
echo $wp_query->found_posts; ?>)
</h1>
@susanlangenes
susanlangenes / remove-tabs.php
Last active December 31, 2015 02:49 — forked from jameskoster/functions.php
WooCommerce - Remove product data tabs
<?php
/*
Plugin Name: Remove WC Product Tabs
Description: Plugin to remove the tabs on single product pages, for WooCommerce.
*/
add_filter( 'woocommerce_product_tabs', 'woo_remove_product_tabs', 98 );
function woo_remove_product_tabs( $tabs ) {
unset( $tabs['description'] ); // Remove the description tab
// put uploaded files into filetype based directories
add_filter('wp_handle_upload_prefilter', 'wpse_25894_handle_upload_prefilter');
add_filter('wp_handle_upload', 'wpse_25894_handle_upload');
function wpse_25894_handle_upload_prefilter( $file )
{
add_filter('upload_dir', 'wpse_25894_custom_upload_dir');
return $file;
}