Skip to content

Instantly share code, notes, and snippets.

View andymagill's full-sized avatar
👀
Looking for Opportunities

Andrew Magill andymagill

👀
Looking for Opportunities
View GitHub Profile
@andymagill
andymagill / Taleo Injector
Created February 8, 2024 14:08
For a consistent navigation and branding, this script loads content, styles and dependencies from one website and injects them into a 3rd party service platform.
// Taleo brandfile external JS
class Injector {
site_url;
style_paths;
script_paths;
script_paths_loaded;
scripts_inited;
@andymagill
andymagill / Example JS class
Last active May 24, 2023 20:23
Simple JS class for copiepasta
// Example Class
class Example {
// properties
// methods
constructor() {
@andymagill
andymagill / .htaccess
Last active December 11, 2022 08:46
HTACCESS rewrite rule not working on SiteGround
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# don't rewrite anything in docs folder to wordpress
RewriteCond %{REQUEST_URI} !^/(docs/*) [NC]
// remove terrible experimental layout support
remove_filter( 'render_block', 'wp_render_layout_support_flag', 10, 2 );
function understrap_experimental_layout( $metadata ) {
if ( !empty($metadata['supports']['__experimentalLayout'])) {
$metadata['supports']['__experimentalLayout'] = false;
}
return $metadata;
}
add_filter( 'block_type_metadata', 'understrap_experimental_layout', 10, 1 );
@andymagill
andymagill / marketo-form-overrides.scss
Last active May 4, 2022 16:02
Marketo Form Overrides
// marketo form overrides
// from https://jennamolby.com/how-to-create-responsive-marketo-forms/
.mktoForm {
&,
.mktoLabel ,
.mktoHtmlText ,
.mktoFormRow,
sudo chown -vR webuser /not/webuser/
@andymagill
andymagill / remove_nav_classes.php
Created November 19, 2019 21:42
Remove injected classes and ID's from navigation - WordPress
<?php
// Remove Injected classes, ID's and page ID's from navigation <li> items
function remove_nav_classes( $var ) {
if ( is_array( $var ) ) {
foreach ( $var as $key => $val ) {
if ( strpos( $val, 'item' ) > -1 && $val != 'current-menu-item' ) {
unset( $var[$key] );
}
@andymagill
andymagill / add_page_name_class.php
Last active November 10, 2019 16:57
Add unique class to body tag - WordPress
<?php
// Add page name to body classes
function add_page_name_class($classes)
{
global $post;
if ( is_page() || is_singular() ) {
$classes[] = sanitize_html_class($post->post_name);
}
return $classes;
}
@andymagill
andymagill / gulpfile.js
Last active November 10, 2019 00:35
Bugged gulp file, generates css in scss folder
var gulp = require("gulp");
var sass = require("gulp-sass");
var sourcemaps = require('gulp-sourcemaps');
function styles() {
return (
gulp.src('scss/**/*.scss')
.pipe(sass({outputStyle: 'compressed'}).on('error', sass.logError))
.pipe(sourcemaps.init())