Skip to content

Instantly share code, notes, and snippets.

@kobojp
kobojp / _blank.js
Created June 21, 2020 14:58 — forked from CrocoDillon/_blank.js
Automatically open external links in new tab or window.
// vanilla JavaScript
var links = document.links;
for (var i = 0, linksLength = links.length; i < linksLength; i++) {
if (links[i].hostname != window.location.hostname) {
links[i].target = '_blank';
}
}
// or in jQuery
# the code is explained here: https://youtu.be/Eex4zBc9r7Y
import os
def main():
files = os.listdir("./")
for f in files:
if f.lower()[-3:] == "mp4":
print "processing", f
process(f)