Skip to content

Instantly share code, notes, and snippets.

Avatar

Jonny MacEachern jonnymaceachern

View GitHub Profile
@rikukissa
rikukissa / .gitignore
Last active Dec 17, 2015
Darker theme for Shout. Has a bit more eye-friendly color scheme and hides some IMO unnecessary features such as "Leave" and "Submit" buttons.
anonymous
anonymous / index.html
Created May 27, 2016
JS Bin // source https://jsbin.com/legeyo
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
<script src="https://wzrd.in/standalone/expect@latest"></script>
<script src="https://wzrd.in/standalone/deep-freeze@latest"></script>
</head>
<body>
@kopiro
kopiro / get-social-counts.php
Created Oct 29, 2011
Get social counts from Facebook, Twitter, GPlus
View get-social-counts.php
<?php
/* Return object of shared counts */
function get_social_count( $link ) {
$r = (object)array();
$r->facebook = get_social_count_facebook($link);
$r->twitter = get_social_count_twitter($link);
$r->gplus = get_social_count_gplus($link);
return $r;
}
@yoren
yoren / functions.php
Last active Jun 24, 2016
Add posts to term JSON data
View functions.php
<?php
function my_json_prepare_term( $data, $term, $context ) {
global $wp_query;
$route = $wp_query->query['json_route'];
if ( ! preg_match( '/(terms\/.+)/', $route) )
return $data;
$args = array(
@cfxd
cfxd / wpcf7_dynamic_email_field.php
Last active Jul 6, 2016
WordPress Contact Form 7 filter: set your contact form's "To:" field to "%admin%" to automatically use the site admin email dynamically. See http://cfxdesign.com/contact-form-7-dynamic-email-field
View wpcf7_dynamic_email_field.php
<?php
function wpcf7_dynamic_email_field($args) {
if(!empty($args['recipient'])) {
$args['recipient'] = str_replace('%admin%', get_option('admin_email'), $args['recipient']);
return $args;
}
return false;
}
add_filter('wpcf7_mail_components', 'wpcf7_dynamic_email_field');
View git-stats-importer.sh
for D in ./*; do
if [ -d "$D" ]; then
cd "$D"
git-stats-importer -e maceachern.jonny@gmail.com
cd ..
fi
done
@sct
sct / DarkMonokai.qss
Created Nov 9, 2012
dark monokai quassel
View DarkMonokai.qss
/**
* ____ _ ___ ___ _ _
* | _ \ | | | \/ | | | (_)
* | | \ |__ _ _ __| | __ | . . | ___ _ __ ___ | | __ __ _ _
* | | | | _` | '__| |/ / | |\/| |/ _ \| '_ \ / _ \| |/ // _` | |
* | |_/ /(_| | | | < | | | | (_) | | | | (_) | <| (_| | |
* |____/\__,_|_| |_|\_\ \_| |_/\___/|_| |_|\___/|_|\_\\__,_|_|
*
* Quassel Theme
*
@jonnymaceachern
jonnymaceachern / index.php
Last active Jul 17, 2017
Get YouTube ID by URL
View index.php
<?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" ) );
@jaygooby
jaygooby / strip_related_videos.php
Created Nov 4, 2011
Always put a rel=0 attribute on Youtube embedded videos so that related videos aren't shown at the end
View strip_related_videos.php