Skip to content

Instantly share code, notes, and snippets.

@DougBeney
DougBeney / functions.php
Created June 7, 2016 18:58
Add social sharing buttons to the top of all your Wordpress posts. (Add this code inside of functions.php)
function crunchify_social_sharing_buttons($content) {
if(is_singular() || is_home()){
// Get current page URL
$crunchifyURL = get_permalink();
// Get current page title
$crunchifyTitle = str_replace( ' ', '%20', get_the_title());
// Get Post Thumbnail for pinterest
@DougBeney
DougBeney / comments.php
Last active August 22, 2016 18:21
Barebones basic comments.php template
<!-- if comments are open -->
<?php if (comments_open) { ?>
<!-- Comment Form -->
<form action="<?php echo site_url('wp-comments-post.php'); ?>" method="post" >
<input type="hidden" name="comment_post_ID" id="comment_post_ID" value="<?php echo $post->ID ?>" />
<input placeholder="Name" type="text" name="author"/><br>
<input placeholder="Email" type="text" name="email"/><br>
<input placeholder="Website (optional)" type="text" name="url"/><br>
@DougBeney
DougBeney / functions.php
Last active September 1, 2016 23:08
Send Email Replies to Wordpress Comments
// BEGIN EMAIL COMMENT REPLY
load_plugin_textdomain('cer_plugin', false, basename( dirname( __FILE__ ) ) . '/languages' );
# Fire Email when comments is inserted and is already approved.
add_action('wp_insert_comment','cer_comment_notification',99,2);
function cer_comment_notification($comment_id, $comment_object) {
if ($comment_object->comment_approved == 1 && $comment_object->comment_parent > 0) {
$comment_parent = get_comment($comment_object->comment_parent);
@DougBeney
DougBeney / functions.php
Last active February 22, 2017 16:23
Truncate Yoast Breadcrumb Titles
<?php
//Truncate Breadcrumb title
function truncate_breadcrumb_title() {
// Get the title of the current post.
if(WPSEO_Meta::get_value( 'bctitle', get_the_ID())){
$title = WPSEO_Meta::get_value( 'bctitle', get_the_ID());
}else{
$title = get_the_title();
@DougBeney
DougBeney / pug.rb
Created June 21, 2017 14:46
Jekyll Pug Plugin
##
## This Plugin enables Pug support to pages and posts.
##
require 'open3'
module Jekyll
class PugConverter < Converter
@DougBeney
DougBeney / Makefile
Last active February 13, 2018 16:09
QT Makefile without QMake or QT Creator
#########################################
# Welcome! #
# This file is intended for Mac OS X, #
# but can work on any other operating #
# systems if you change QT_INSTALL_PATH #
# -Created by @DougBeney #
#########################################
# In the first two lines, I define the source (.cpp) file and the desired output file to be created (./hello)
SOURCE = hello.cpp
@DougBeney
DougBeney / keyboard.py
Last active November 15, 2017 20:46
Python Script to switch CMD and CTRL on command.
#! /usr/bin/python
import sys
import os
project_name = "keyboard"
def switchLayout(layout):
desired_layout_path = "/opt/" + project_name + "/symbols/" + layout
@DougBeney
DougBeney / Vagrantfile
Last active May 23, 2018 15:46
Minimal Vagrantfile for a basic Nginx static site
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/bionic64"
config.vm.network "forwarded_port", guest: 80, host: 8000
config.vm.provision "shell", inline: <<-SHELL
apt-get update
apt-get upgrade -y
apt-get install -y nginx
systemctl start nginx
ln -sf /vagrant /var/www/site
Computer Information:
Manufacturer: Unknown
Model: Unknown
Form Factor: Desktop
No Touch Input Detected
Processor Information:
CPU Vendor: GenuineIntel
CPU Brand: Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz
CPU Family: 0x6
ERROR: ld.so: object '/home/doug/.steam/ubuntu12_32/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored.
ERROR: ld.so: object '/home/doug/.steam/ubuntu12_32/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored.
ERROR: ld.so: object '/home/doug/.steam/ubuntu12_32/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored.
ERROR: ld.so: object '/home/doug/.steam/ubuntu12_32/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored.
2014.650:0008:0009:trace:module:load_builtin_callback loaded ntdll.dll 0x10380 0x7bc20000
2014.650:0008:0009:trace:module:load_builtin_dll Trying built-in L"kernel32.dll"
2014.650:0008:0009:trace:module:load_dll looking for L"ntdll.dll" in L""
2014.650:0008:0009:trace:module:load_dll Found L"C:\\windows\\system32\\ntdll.dll" for L"ntdll.dll" at 0x7bc20000, count=2
2014.650:0008:0009:trace:module:load_builtin_call