Skip to content

Instantly share code, notes, and snippets.

View sebkolind's full-sized avatar
zap!

Sebastian L. K. Sørensen sebkolind

zap!
View GitHub Profile
@sebkolind
sebkolind / remove-classes.js
Created October 13, 2023 19:00
Remove all classes from element
const el = document.querySelector('.my-el');
el.classList.remove(...el.classList);
@sebkolind
sebkolind / array-move-by-one.ts
Last active April 26, 2022 05:19
Move all items in an array in either direction by one in Typescript. Does not mutate the source array, and returns a new array.
function arrayMoveByOne(source: unknown[], reverse = false): unknown[] {
const s = [...source];
const c = [...s];
let i = 0;
while (i < s.length) {
if (reverse) {
if (s[i - 1] == null) {
c[s.length - 1] = s[0];
@sebkolind
sebkolind / gnome-irc-matrix.md
Last active October 26, 2021 16:23
How to join Gnome IRC rooms via Matrix.org

This is so that I can remember how to join Gnome IRC / GIMP Networks rooms via Matrix.org.

This works for Fractal, but should work for any Matrix client

#_gimpnet_#ROOM_NAME:gnome.org

Example:

@sebkolind
sebkolind / mega-dropdown.scss
Created April 14, 2019 16:44
Mega dropdown - Vanilla JS - SCSS
.dropdown {
position: absolute;
top: 30px;
z-index: 10;
left: 0;
width: 300px;
height: 300px;
opacity: 0;
transition: transform 0.3s, opacity 0.5s;
will-change: transform, opacity;
@sebkolind
sebkolind / mega-dropdown.html
Created April 14, 2019 16:35
Mega dropdown - Vanilla JS - HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Awesome mega dropdown</title>
</head>
<body>
<nav>
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// choose either `'stable'` for receiving highly polished,
// or `'canary'` for less polished but more frequent updates
updateChannel: 'stable',