Skip to content

Instantly share code, notes, and snippets.

Dan Gold danielcgold

Block or report user

Report or block danielcgold

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
@danielcgold
danielcgold / nav_walker.php
Created Sep 21, 2016
[WordPress] add concepts of the description link in all menu items.
View nav_walker.php
<?
function nav_description( $item_output, $item, $depth, $args ) {
if ( $item->description ) {
$item_output = str_replace( $args->link_after . '</a>', '<span class="menu-item-description">' . $item->description . '</span>' . $args->link_after . '</a>', $item_output );
}
return $item_output;
}
add_filter( 'walker_nav_menu_start_el', 'nav_description', 10, 4 );
?>
View post-merge
#/usr/bin/env bash
# MIT © Sindre Sorhus - sindresorhus.com
# git hook to run a command after `git pull` if a specified file was changed
# Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep --quiet "$1" && eval "$2"
@danielcgold
danielcgold / gist:f8ddef79e815a56f57f7
Last active Aug 29, 2015
JS function to return date and time
View gist:f8ddef79e815a56f57f7
function getDateAndTime(){
// get the date string from JS
var d = new Date();
var currDate = d.getDate();
var currMonth = d.getMonth();
var currYear = d.getFullYear();
var currHour = d.getHours();
var currMin = d.getMinutes();
@danielcgold
danielcgold / circle.scss
Created Apr 24, 2013
Create a simple circle with Sass
View circle.scss
/* Use: @include circle(1em); */
@mixin circle($size) {
width: $size; height: $size; @include border-radius($size/2);
}
You can’t perform that action at this time.