Skip to content

Instantly share code, notes, and snippets.

View CFranc111's full-sized avatar

Chris Franchetti Michaels CFranc111

  • Novato, CA
  • 14:26 (UTC -07:00)
View GitHub Profile
@CFranc111
CFranc111 / Ball.cs
Last active June 25, 2017 04:48
Unity Block Breaker ball script as of 01.31.16
using UnityEngine;
using System.Collections;
public class Ball : MonoBehaviour {
public bool debug = false;
private Paddle paddle;
private bool hasStarted = false;
private string[] makeHitSounds = new string[6] {"Paddle", "LeftWall", "RightWall", "TopWall", "BottomWall", "Invincible"};
@CFranc111
CFranc111 / plugin.php
Created August 16, 2019 21:41
Failed attempt - replace ACF YouTube URL with nocookie URL
function miunus6db_youtube_nocookie( $post_id ) {
if( get_field('video', $post_id) ) {
$url = get_field('video', $post_id, false);
$url = str_replace( 'youtube.com/watch?v=', 'youtube-nocookie.com/embed/', get_field('video', $post_id, false));
update_field('video', $url, $post_id);
}
@CFranc111
CFranc111 / gist:ca7b7ab6108ce293365f380d5e99b6b2
Created August 22, 2019 16:51
Wordpress add lazy loading all content
function enzothecat_add_lazy_loading($content) {
$content = preg_replace('/src="/', 'loading="lazy" src="', $content);
return $content;
}
add_filter('the_content', 'enzothecat_add_lazy_loading');
@CFranc111
CFranc111 / functions.php
Last active August 23, 2019 00:28
Wordpress jQuery cookie example
function custom_main_scripts() {
// Enqueue plugin here, if needed, including array('jquery') as the 3rd argument as a dependency (see below)
// Enqueue custom javascript file
wp_register_script( 'my-scripts', get_stylesheet_directory_uri() . '/myfile.js', array('jquery'), filemtime( get_template_directory() . '/myfile.js' ), true );
}
add_action( 'wp_enqueue_scripts', 'custom_main_scripts' );