Skip to content

Instantly share code, notes, and snippets.

View jonnymaceachern's full-sized avatar

Jonny jonnymaceachern

  • Developer @ Media Mechanics
  • Halifax, NS
  • 02:30 (UTC -03:00)
View GitHub Profile
@rikukissa
rikukissa / .gitignore
Last active December 17, 2015 17:18
Darker theme for Shout. Has a bit more eye-friendly color scheme and hides some IMO unnecessary features such as "Leave" and "Submit" buttons.
.DS_Store
git ls-files --deleted -z | xargs -0 git rm
anonymous
anonymous / index.html
Created May 27, 2016 16:19
JS Bin // source https://jsbin.com/legeyo
<!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 October 29, 2011 11:17
Get social counts from Facebook, Twitter, GPlus
<?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 June 24, 2016 13:41
Add posts to term JSON data
<?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 July 6, 2016 15:39
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
<?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');
@jonnymaceachern
jonnymaceachern / git-stats-importer.sh
Created October 3, 2016 14:04
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 November 9, 2012 21:04
dark monokai quassel
/**
* ____ _ ___ ___ _ _
* | _ \ | | | \/ | | | (_)
* | | \ |__ _ _ __| | __ | . . | ___ _ __ ___ | | __ __ _ _
* | | | | _` | '__| |/ / | |\/| |/ _ \| '_ \ / _ \| |/ // _` | |
* | |_/ /(_| | | | < | | | | (_) | | | | (_) | <| (_| | |
* |____/\__,_|_| |_|\_\ \_| |_/\___/|_| |_|\___/|_|\_\\__,_|_|
*
* Quassel Theme
*
@jonnymaceachern
jonnymaceachern / index.php
Last active July 17, 2017 16:50
Get YouTube ID by URL
<?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 November 4, 2011 13:51
Always put a rel=0 attribute on Youtube embedded videos so that related videos aren't shown at the end