const specialKey = navigator.userAgent.indexOf('Macintosh') != -1 ? "metaKey" : "ctrlKey"; | |
const otherKeys = ['altGraphKey','altKey','ctrlKey','metaKey','shiftKey'].filter(k => k !== specialKey); | |
document.addEventListener('keydown', event => { | |
if (event.code === key && event[specialKey] === true && !otherKeys.some(k => event[k] === true)) { | |
// Do something | |
event.preventDefault(); | |
} | |
}); |
compstring () { | |
STR_A_IN=$1 | |
STR_B_IN=$2 | |
STR_A_OUT="" | |
STR_B_OUT="" | |
POINTER="" | |
LENGTH=${#STR_A_IN} | |
if [ $# -lt 2 ] || [ -z $1 ]|| [ -z $2 ]; then | |
echo "You must provide two strings to compare" | |
return 1 |
(function(){ | |
var r, l, s, a, v, i; // (1) | |
r = /(?:97[89])?[-\s]?[0-9]{1}[-\s]?[0-9]{3}[-\s]?[0-9]{3}[-\s]?[0-9]{2}[-\s]?[0-9X]{1/; // (2) | |
l = window.location.href.match(r); // (3) | |
s = window.getSelection().toString().match(r); // (4) | |
a = document.activeElement; | |
if (a.value) { v = a.value.slice(a.selectionStart, a.selectionEnd).match(r) } // (5) | |
i = ""; // (6) | |
if (l) { i = l[0] } | |
if (s) { i = s[0] } |
#!/bin/bash | |
if [[ $(networksetup -getairportpower en0) == *On ]] | |
then | |
networksetup -setairportpower en0 off | |
else | |
networksetup -setairportpower en0 on | |
fi |
I hereby claim:
- I am ngsctt on github.
- I am nathanscott (https://keybase.io/nathanscott) on keybase.
- I have a public key ASAQjsej-Kf0IgUTzM6b3NjkVOGr66gdevswYFB_N-_hmwo
To claim this, I am signing this object:
Method (and limitations) described here: http://nadeausoftware.com/articles/2007/05/stop_spammer_email_harvesters_obfuscating_email_addresses
Without plugins, it's difficult to use obfuscated email addresses in Hugo. Additionally, Hugo will aggressively escape anything you introduce to a template, especially if it's a href
attribute.
To use a character entities obfuscation technique (eg. that of http://wbwip.com/wbw/emailencoder.html), place email.html
in the layouts/shortcodes
folder, and place emails.yml
in the data
folder.
The contact
email in emails.yml
is the character entity-encoded form of [email protected]
. It will be the default email used if you call the email shortcode (by using {{< email >}}
or {{< email contact >}}
in your page content) without any parameters. You can add other emails to emails.yml
and use them in the email shortcode by passing their key as a parameter, eg: {{< email newKey >}}
--- | |
layout: none | |
--- | |
<?xml version="1.0" encoding="UTF-8"?> | |
<rss version="2.0" xmlns:excerpt="http://wordpress.org/export/1.2/excerpt/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:wp="http://wordpress.org/export/1.2/"> | |
<channel> | |
<title>{{ site.name }}</title> | |
<link>{{ site.url }}</link> | |
<description>{{ site.description | xml_escape }}</description> | |
<pubDate/> |
Working out what sizes/formats/filenames to use for favicons is confusing---especially if you're trying to support legacy browsers. There are some great lists out there, but they are often out-of-date or incomplete. So here's a new one:
Place favicon.ico
in root directory---include a 16x16 and 32x32 image. This will be effective for most browsers. Do not add a link to the head---browsers that can use png icons may ignore them in favour of the lower-quality ico if you do.
favicon.png
as a 32x32 icon for browsers that can handle png.
Icons for use in modern browsers (eg. Safari 8+) and mobile devices.