Korbs / Detect Internet Explorer with JavaScript
0 likes
0 forks
1 files
Last active
Based on old code from over 5 years ago
1 | function GetIEVersion() { |
2 | var sAgent = window.navigator.userAgent; |
3 | var Idx = sAgent.indexOf("MSIE"); |
4 | if (Idx > 0) |
5 | return parseInt(sAgent.substring(Idx+ 5, sAgent.indexOf(".", Idx))); |
6 | else if (!!navigator.userAgent.match(/Trident\/7\./)) |
7 | return 11; else return 0; |
8 | } |
9 | if (GetIEVersion() > 0) {document.write("This is IE " + GetIEVersion());document.write('<div id="out"><p>You are using an unsupported browser.</p><p style="font-size: 14px;">Try a different web browser:</p><ui><li><a href="https://www.microsoft.com/en-us/edge?r=1">Microsoft Edge</a></li><li><a href="https://www.google.com/chrome/">Google Chrome</a></li><li><a href="https://www.mozilla.org/en-US/firefox/new/">Firefox</a></li><li><a href="https://opera.com/">Opera</a></li></ui><p>You are using Internet Explorer ' + GetIEVersion() +'</p></div> <style>a {color: white;} li {font-size: 14px;} div#out {position: fixed;z-index: 999;background: black;color: white;border: none;top: 0px;left: 0px;width: 100%;height: 100%;padding: 30px;}</style>')} else {} |
Korbs / Zot Docker Setup
0 likes
0 forks
3 files
Last active
Straight-forward setup for Zot in Docker. Steps are also included how to use it as a Docker registry.
Zot Docker Setup
Setup Zot in Docker
This is mostly how SudoVanilla's Docker registry is setup.
I'm still new to Zot, so some information below could be inaccurate and some important information could be missing too.
Configuration
Korbs / Include HTML File
0 likes
0 forks
3 files
Last active
This is kinda like including a component in a JS framework using the "import" function, but with vanilla JavaScript.
1 | function includeHTML() { |
2 | var z, i, elmnt, file, xhttp; |
3 | z = document.getElementsByTagName("*"); |
4 | for (i = 0; i < z.length; i++) { |
5 | elmnt = z[i]; |
6 | file = elmnt.getAttribute("include-html"); |
7 | if (file) { |
8 | xhttp = new XMLHttpRequest(); |
9 | xhttp.onreadystatechange = function() { |
10 | if (this.readyState == 4) { |
Korbs / Detect Operating System with JavaScript
0 likes
0 forks
1 files
Last active
1 | var htmlElement = document.documentElement; |
2 | if (navigator.platform.match(/(Mac)/i)) { |
3 | htmlElement.className = 'Mac' |
4 | } |
5 | if (navigator.platform.match(/(Linux)/i)) { |
6 | htmlElement.className = 'Linux' |
7 | } else { |
8 | htmlElement.className = 'Windows' |
9 | } |
10 | document.addEventListener('click', function(event) { |
Korbs / Lemmy Instance in Docker
0 likes
0 forks
4 files
Last active
Lemmy Instance in Docker
This is how SudoVanilla's Lemmy server is setup.
Create a folder for your Lemmy instance and change over to it in your terminal:
mkdir lemmy
cd lemmy
Korbs / Buildah - Build and Push
0 likes
0 forks
1 files
Last active
Build and push an OCI image with the Buildah command line
Buildah - Build and Push
Build
To build an OCI image, use the build
option and name the OCI image with the -t
tag variable:
buildah build -t registry.whatever.org/image-name
You can also add metadata to it like a description with the --annotation
variable, by adding:
Korbs / Rename Batch in Bash
0 likes
0 forks
1 files
Last active
Rename a bunch of files with the same file extension
1 | find . | grep 'JPG' | nl -nrz -w3 -v0001 | while read n f; do mv "$f" "$n.JPG"; done |
Korbs / Sync Video and Audio
0 likes
0 forks
2 files
Last active
In HTML5, sync both video and audio with JavaScript.
1 | <video controls id="main-video" src="video.mp4"/> |
2 | <audio id="main-audio" src="audio.mp4"/> |
Korbs / Git: Creating an Orphan Branch
0 likes
0 forks
1 files
Last active
1 | cd repository |
2 | git checkout --orphan NEW_ORPHAN_BRANCH_NAME |
3 | git rm -rf . |
4 | rm '.gitignore' |
5 | echo "# New Orphan Branch" > README.md |
6 | git add README.md |
7 | git commit -a -m ":rocket: Init" |
8 | git push origin NEW_ORPHAN_BRANCH_NAME |
Newer
Older