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
@irazasyed
irazasyed / outbound-email-with-cloudflare.md
Last active May 9, 2024 06:12
Using Gmail SMTP with Cloudflare Email Routing: A Step-by-Step Guide

Using Gmail SMTP with Cloudflare Email Routing: Step-by-Step Guide

Learn how to send emails through Gmail SMTP with Cloudflare Email Routing in this comprehensive guide.

Step 1: Enable 2-Factor Authentication

To proceed with this method, ensure that you have enabled two-factor authentication for your Google account. If you haven't done so already, you can follow the link to set it up → Enable 2FA in your Google account.

Step 2: Create an App Password for Mail

@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;
}
@srsad
srsad / schema.tpl
Created August 4, 2017 13:15
pdoCrumbs по стандарту микроразметок schema.org
{'pdoCrumbs' | snippet : [
'showHome' => 1,
'showHidden' => 0,
'tpl' => '@INLINE <li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
<a href="{{+link}}" itemscope itemtype="http://schema.org/Thing" itemprop="item">
<span itemprop="name">{{+menutitle}}</span>
</a>
<meta itemprop="position" content="{{+idx}}" />
</li>',
'tplCurrent' => '@INLINE <li class="active" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
@M165437
M165437 / db-connect-test.php
Last active May 26, 2023 05:34 — forked from chales/db-connect-test.php
Script for a quick PHP MySQL DB connection test.
<?php
# Fill our vars and run on cli
# $ php -f db-connect-test.php
$dbname = 'name';
$dbuser = 'user';
$dbpass = 'pass';
$dbhost = 'host';
$link = mysqli_connect($dbhost, $dbuser, $dbpass) or die("Unable to Connect to '$dbhost'");
@cstewart90
cstewart90 / OpenWithSublimeText3.bat
Last active March 27, 2024 07:17 — forked from interisti/OpenWithSublimeText3.bat
Open folders and files with Sublime Text 3 from windows explorer context menu (tested in Windows 10)
@echo off
SET st3Path=C:\Program Files\Sublime Text 3\sublime_text.exe
rem add it for all file types
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_EXPAND_SZ /v "Icon" /d "%st3Path%,0" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3\command" /t REG_SZ /v "" /d "%st3Path% \"%%1\"" /f
rem add it for folders
@reg add "HKEY_CLASSES_ROOT\Directory\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f
@sepiariver
sepiariver / twog-modx.html
Last active February 26, 2020 15:01
Twitter/OG Meta Tags for MODX
<!-- Open Graph Tags -->
<meta property="og:site_name" content="[[++site_name]]" />
<meta property="og:type" content="article" />
<meta property="og:title" content="[[*longtitle:default=`[[*pagetitle]]`]]" />
<meta property="og:description" content="[[*description:default=`[[++site_description]]`]]" />
<meta property="og:url" content="[[~[[*id]]? &scheme=`full`]]" />
<meta property="og:image" content="[[*image:default=`[[++site_image]]`]]" />
<meta property="fb:app_id" content="[[++fb_app_id]]" />
<meta property="article:publisher" content="[[++fb_url]]" />
<!-- Twitter Tags -->
@himynameisdave
himynameisdave / button-animated.less
Last active March 7, 2019 21:12
Animated CSS Gradient Complete
.button {
background-size: 100%;
background-image: linear-gradient(#fff, #ccc);
border-radius: 0.45rem;
border: 1px solid #ddd;
cursor: pointer;
color: #333;
display: inline-block;
font-size: 1.25rem;
font-weight: 300;
@hissy
hissy / rscsv-divide-meta-fields.php
Created April 6, 2015 01:29
Divide Meta Fields with Comma (Really Simple CSV Importer add-on)
<?php
/*
Plugin Name: Divide Meta Fields with Comma (Really Simple CSV Importer add-on)
*/
add_filter('really_simple_csv_importer_save_meta', function($meta, $post, $is_update) {
foreach ($meta as $key => $value) {
if (strpos($value, ',') !== false) {
$_value = preg_split("/,+/", $value);
$meta[$key] = $_value;