This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am jonnymaceachern on github. | |
* I am jonnymaceachern (https://keybase.io/jonnymaceachern) on keybase. | |
* I have a public key whose fingerprint is 6A78 AA59 B2AD 89D9 C60D 0EB3 73C0 1EBB 9860 CAA3 | |
To claim this, I am signing this object: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var cousins = []; | |
// Find all elements that begin with class and return just that matching class | |
$('[class^=equalize-').each(function(index, el, array) { | |
var group = $(el).attr('class').match(/\bequalize-[\S]*/); | |
if ( group.length ) { | |
cousins.push( group[0] ); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('a').attr('target', function() { | |
if(this.host == location.host) return '_self' | |
else return '_blank' | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=SUM(INDIRECT("B1:"&ADDRESS(ROW()-1,COLUMN(),4))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Define custom query parameters | |
$custom_query_args = array( /* Parameters go here */ ); | |
// Get current page and append to custom query parameters array | |
$custom_query_args['paged'] = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1; | |
// Instantiate custom query | |
$custom_query = new WP_Query( $custom_query_args ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git rev-list -n 1 HEAD -- <file_path> | |
git checkout <deleting_commit>^ -- <file_path> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Remove the unit of a length | |
/// @param {Number} $number - Number to remove unit from | |
/// @return {Number} - Unitless number | |
@function strip-unit($number) { | |
@if type-of($number) == 'number' and not unitless($number) { | |
@return $number / ($number * 0 + 1); | |
} | |
@return $number; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Remove related videos from youtube embeds | |
add_filter('embed_oembed_html', 'remove_related_videos_from_yt_oembed', 10, 3); | |
function remove_related_videos_from_yt_oembed($html, $url, $args = array()) { | |
if(!stristr($html, 'youtube.com/embed/')) | |
return $html; | |
preg_match('/src="(.+?(?="))/', $html, $matches); | |
if(count($matches) >= 2 && stristr($matches[1], 'youtube.com/embed/')) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function get_youtube_id( $url ) { | |
preg_match( "#(?<=v=)[a-zA-Z0-9-]+(?=&)|(?<=v\/)[^&\n]+|(?<=v=)[^&\n]+|(?<=youtu.be/)[^&\n]+#", $url, $matches ); | |
return $matches[0]; | |
} | |
// Test | |
echo get_youtube_id( "https://youtu.be/MZj1bQtRNdk" ) ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exclude = !sh -c 'echo "$1" >> .git/info/exclude' - |