Skip to content

Instantly share code, notes, and snippets.

View mvsde's full-sized avatar
🏳️‍⚧️
Protect trans kids!

Fynn Becker mvsde

🏳️‍⚧️
Protect trans kids!
View GitHub Profile
@mvsde
mvsde / get-data-type.js
Created June 12, 2019 05:19
Get JavaScript data type
/**
* Get data type
* @see {@link https://gomakethings.com/a-better-way-to-create-an-immutable-copy-of-an-array-or-object-with-vanilla-js/}
*
* @param {} item Thing we want the type of
* @returns {String} Thing's type
*/
function getDataType (item) {
/**
* Unfortunately, `typeof` isn't that useful to detect types like `array`
@mvsde
mvsde / parseISODate.js
Last active September 2, 2019 09:52
`new Date()` that works in Safari
/**
* Parse ISO date string
*
* This convoluted mess is necessary because lovely Safari doesn't use the
* local time zone during `new Date(…)`!
* @param {'YYYY-MM-DD'} date Date string
* @param {'HH:MM:SS'} time Time string
* @returns {Date} Parsed date
*/
export default function (date, time) {
@mvsde
mvsde / markup.html
Last active September 23, 2019 09:54
Simple color theme system with Dart Sass
<div class="is-primary">
<button class="button">I'm primary</button>
</div>
<div class="is-secondary">
<button class="button">I'm secondary</button>
</div>
@mvsde
mvsde / consumer.js
Last active August 20, 2020 06:19
Basic reactive store with Vue 3: https://v3.vuejs.org/api/basic-reactivity.html
import store from './store.js'
console.log(store.state.hello) // '🌍'
store.greet('🌌')
console.log(store.state.hello) // '🌌'
console.log(store.state.cool) // Set('🍍')
store.addCool('🍌')
console.log(store.state.cool) // Set('🍍', '🍌')
@mvsde
mvsde / focus-visible.css
Last active August 27, 2020 08:14
CSS niceties
/* https://developer.mozilla.org/en-US/docs/Web/CSS/:focus-visible */
:focus:not(:focus-visible) {
outline: 0;
}
@mvsde
mvsde / disable-smart-dimming.md
Last active November 2, 2020 13:31
Disable Samsung Smart TV dimming

Disable Samsung Smart TV dimming

Enter service menu

Press the following keys on the remote:

  1. Info
  2. Settings
  3. Mute
  4. Power
@mvsde
mvsde / execute.sh
Last active May 4, 2021 10:43
Under-engineered multi-package management script. Uses only basic shell commands for compatibility with Docker alpine images.
#!/bin/sh
# Usage:
# -e: Exclude folders
# -p: Prioritize folders
# -c: Run this command
# execute.sh -e "folder1 folder2" -p "folder3 folder4" -c "command"
while getopts "e:p:c:" OPTION; do
case "$OPTION" in
@mvsde
mvsde / fonts.scss
Created June 30, 2021 08:35
Self-hosted fonts with Fontsource
/**
* Fontsource makes open source fonts available on npm.
* https://github.com/fontsource/fontsource
*/
@use "@fontsource/font-name/scss/mixins" as font-name;
@include font-name.fontFace(
$weight: 400,
$style: normal,
@mvsde
mvsde / disable-twitter-interests.js
Created July 22, 2021 12:03
Disable all “interests” Twitter thinks you are interested in.
/**
* Copy into dev tools console and hit enter.
* It may take a while and the page will be blocked while the script is running.
*
* Source:
* https://twitter.com/ChrisFerdinandi/status/1417947102731190277
* https://twitter.com/ChrisFerdinandi/status/1417947104111104002
*/
let checked = document.querySelectorAll('input:checked')
@mvsde
mvsde / _device.md
Last active January 29, 2022 09:58
Image performance on a fast machine