Korbs / Ambient Video Effect
0 likes
0 forks
3 files
Last active
1 | <div class="video-container"> |
2 | <canvas id="ambient-canvas-1"/> |
3 | <canvas id="ambient-canvas-2"/> |
4 | <video src="./video.mp4"></video> |
5 | </div> |
Korbs / Astro: If Else Statement
0 likes
0 forks
1 files
Last active
Astro - If Else Statements
Basic
With a true
or false
statement, we can simply create something like a link or button that changes depending on if the user is signed in.
Let's start out this example:
---
var UserLogin = false
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 |
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 / 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 / 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 / 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 / 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 / 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) { |
Newer
Older