Skip to content

Instantly share code, notes, and snippets.

View cowgill's full-sized avatar

David Cowgill cowgill

View GitHub Profile
@cowgill
cowgill / docker_aliases_functions
Last active February 3, 2019 17:50
Alias and function list for Docker commands.
# Put these in ~/.bash_profile and save
# Then source the file to activate them
# source ~/.bash_profile
#
# Credit for original list
# https://github.com/tcnksm/docker-alias/blob/master/zshrc
# Get process included stop container
alias dps="docker ps -a"
@cowgill
cowgill / style.css
Created May 1, 2018 01:53
Highlight the Current Page In WordPress Using CSS
#leftcontent li.current_page_item a:link, #leftcontent li.current_page_item
a:visited, #leftcontent li.current_page_item a:hover, #leftcontent
li.current_page_item a:active {
font-weight: bold;
color:#FFFFFF;
padding:0px 0px 0px 7px;
background-position: 0px 0px;
background:url(images/li_bg.jpg) no-repeat;
}
@cowgill
cowgill / header.php
Last active May 1, 2018 01:53
Highlight the Current Page In WordPress Using CSS
<div class="leftsidebar">
<ul>
<li <?php if( is_home() ) { echo 'class="current_page_item"'; } ?>>
<a href="/wordpress/">Home</a></li>
<?php wp_list_pages( 'title_li=&depth=1' );?>
</ul>
</div>
@cowgill
cowgill / google-maps-address-autocomplete.html
Created December 17, 2016 07:03
Google maps address autocomplete example
<html>
<head>
<script type='text/javascript' src='//maps.googleapis.com/maps/api/js?libraries=places&#038;region=us&#038;language=en&#038;unit=mi&#038;key=AIzaSyCg7Bzy277zhIIYinvQN0Q9sPr8s&#038;callback'></script>
<script>
jQuery( function( $ ) {
function testMapAutoCompleteInit() {
@cowgill
cowgill / post-receive
Last active December 16, 2016 06:22
Git post-receive hook script used for automatic deployment from localhost to live server
#!/bin/sh
#
# Used for automatic deployment from localhost to live server
# Triggered when `git push live` is run locally (tutorial below must be followed first)
#
# Based off this Digital Ocean tutorial
# https://www.digitalocean.com/community/tutorials/how-to-set-up-automatic-deployment-with-git-with-a-vps
#
# Put this script in your local repo folder. Then set perms
# {YOUR_REPO}/.git/hooks/post-receive
@cowgill
cowgill / gist:8184223
Created December 30, 2013 16:22
Trying to get closure_tree to render a drop down with categories and sub-categories nested. Neither of the two items work.
<%= form_for(@item, html: {class: 'form_auth'}) do |f| %>
<% if @item.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@item.errors.count, "error") %> prohibited this item from being saved:</h2>
<ul>
<% @item.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
@cowgill
cowgill / gist:5592248
Created May 16, 2013 14:46
Block all WordPress comments that try include a url.
+// check honeypot field when a new comment is submitted
+// we hide the url field from normal visitors via css
+function at_pre_comment_check() {
+
+ if ( ! empty( $_POST['url'] ) )
+ wp_die( "Comment rejected because it triggered our spam filter. Disable any auto form filler and try again." );
+
+}
+add_action( 'pre_comment_on_post', 'at_pre_comment_check' );