This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Create an alert with the number of YouTube and Vimeo | |
* videos on the current page. | |
*/ | |
function countVideosOnPage() { | |
var iframes = document.getElementsByTagName("iframe"); | |
var youtubeVideos = []; | |
var vimeoVideos = []; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Function with options object parameter | |
* | |
* Dependencies | |
* ------------ | |
* An extend helper function or the jquery extend method to merge the defaults | |
* and options objects. | |
* | |
* 1. Merge defaults and options objects into new settings object. | |
* 2. Assign variables to settings properties. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# I would recommend saving this function in your .bash_profile file or wherever you keep your custom functions. | |
# Alternatively you could save this in a shell script file. | |
# The function takes up to 4 arguments. FROM, TO, TIME & DATE. Change the defaults below to whatever suits you. | |
# With no arguments passed this will get you the next trains between the default (Leeds and Kings Cross) stations. | |
# This works in a bash shell on Mac OSX. If you are not a Mac user, replace the "open" command with whichever one works on your platform. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# If you have a static site with just html files and have a setup which allows | |
# you to access pages with pretty URLs (e.g. /about/) without the index.html | |
# extension, this will generate the list of paths, which you can paste straight | |
# into the Facebook batch invalidator. | |
# If you are not a Mac user, you can change pbcopy to your choice of tool to | |
# copy to clipboard, or remove it and just copy manually from the command line. | |
# Just change the values of the FOLDER and DOMAIN vars to your own. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[alias] | |
upstream = "!f() { \ | |
REMOTE=${1-origin}; \ | |
OUTPUT=$(echo $(git push -u $REMOTE $(git rev-parse --abbrev-ref HEAD))); \ | |
echo $OUTPUT; \ | |
}; f" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"No Opener": { | |
"prefix": "blank", | |
"body": [ | |
"target=\"_blank\" rel=\"noopener\"" | |
], | |
"description": "Add rel=noopener to links with target=_blank" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[alias] | |
ba = "!f() { \ | |
LEFT=${1-master}; \ | |
RIGHT=${2-HEAD}; \ | |
OUTPUT=$(echo $(git rev-list --left-right --count $LEFT...$RIGHT) "$LEFT $RIGHT" | awk '{print $4\" is \"$1\" behind and \"$2\" ahead of \"$3}');\ | |
echo $OUTPUT; \ | |
}; f" | |
# Example: | |
# $ git ba develop feature/shiny-new-feature |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Check for bucket name argument | |
if [ ! -z "$1" ]; then | |
# Assign first argument to BUCKET variable | |
BUCKET=$1; | |
# Assign second argument to REGION variable or fallback to EU (Ireland) region if not provided. | |
REGION=${2:-"eu-west-1"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
# Are you looking for a front-end developer? I’m looking for a new role! | |
# | |
# andycdev@gmail.com | |
# andycochrane.co.uk | |
## | |
'*.html': | |
'Target Blank (with rel="noopener")': | |
'prefix': 'blank' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dotfiles=$(find ~/dotfiles/* -type f) | |
for f in $dotfiles; do | |
. "$f" | |
done |