Skip to content

Instantly share code, notes, and snippets.

@danielcgold
danielcgold / circle.scss
Created April 24, 2013 15:09
Create a simple circle with Sass
/* Use: @include circle(1em); */
@mixin circle($size) {
width: $size; height: $size; @include border-radius($size/2);
}
@danielcgold
danielcgold / gist:f8ddef79e815a56f57f7
Last active August 29, 2015 14:09
JS function to return date and time
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();
#/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 / nav_walker.php
Created September 21, 2016 13:02
[WordPress] add concepts of the description link in all menu items.
<?
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 );
?>