Skip to content

Instantly share code, notes, and snippets.

David Cowgill cowgill

Block or report user

Report or block cowgill

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
cowgill / docker_aliases_functions
Last active Feb 3, 2019
Alias and function list for Docker commands.
View docker_aliases_functions
# Put these in ~/.bash_profile and save
# Then source the file to activate them
# source ~/.bash_profile
# Credit for original list
# Get process included stop container
alias dps="docker ps -a"
cowgill / style.css
Created May 1, 2018
Highlight the Current Page In WordPress Using CSS
View style.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;
padding:0px 0px 0px 7px;
background-position: 0px 0px;
background:url(images/li_bg.jpg) no-repeat;
cowgill / header.php
Last active May 1, 2018
Highlight the Current Page In WordPress Using CSS
View header.php
<div class="leftsidebar">
<li <?php if( is_home() ) { echo 'class="current_page_item"'; } ?>>
<a href="/wordpress/">Home</a></li>
<?php wp_list_pages( 'title_li=&depth=1' );?>
cowgill / google-maps-address-autocomplete.html
Created Dec 17, 2016
Google maps address autocomplete example
View google-maps-address-autocomplete.html
<script type='text/javascript' src='//;region=us&#038;language=en&#038;unit=mi&#038;key=AIzaSyCg7Bzy277zhIIYinvQN0Q9sPr8s&#038;callback'></script>
jQuery( function( $ ) {
function testMapAutoCompleteInit() {
cowgill / post-receive
Last active Dec 16, 2016
Git post-receive hook script used for automatic deployment from localhost to live server
View post-receive
# 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
# Put this script in your local repo folder. Then set perms
# {YOUR_REPO}/.git/hooks/post-receive
cowgill / gist:8184223
Created Dec 30, 2013
Trying to get closure_tree to render a drop down with categories and sub-categories nested. Neither of the two items work.
View gist:8184223
<%= 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>
<% @item.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
cowgill / gist:5592248
Created May 16, 2013
Block all WordPress comments that try include a url.
View gist:5592248
+// 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' );
You can’t perform that action at this time.