Skip to content

Instantly share code, notes, and snippets.

Avatar
🖤
Black Lives Matter

Fynn Becker mvsde

🖤
Black Lives Matter
View GitHub Profile
@mvsde
mvsde / disable-smart-dimming.md
Last active Nov 2, 2020
Disable Samsung Smart TV dimming
View disable-smart-dimming.md

Disable Samsung Smart TV dimming

Enter service menu

Press the following keys on the remote:

  1. Info
  2. Settings
  3. Mute
  4. Power
View focus-visible.css
/* https://developer.mozilla.org/en-US/docs/Web/CSS/:focus-visible */
:focus:not(:focus-visible) {
outline: 0;
}
View consumer.js
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 / prefers-reduced-motion.scss
Last active Jul 22, 2020
Respect `prefers-reduced-motion` media query
View prefers-reduced-motion.scss
/**
* Respect `prefers-reduced-motion` media queries and devices with a slow
* refresh rate / display update time.
*
* Source: https://css-tricks.com/levels-of-fix/
*/
*,
*::before,
*::after {
@mvsde
mvsde / update-docker-compose.zsh
Created Jan 7, 2020
Update docker-compose to the latest version
View update-docker-compose.zsh
function update-docker-compose () {
local dc_path="/usr/local/bin/docker-compose"
curl --silent https://api.github.com/repos/docker/compose/releases/latest \
| grep --perl-regexp --only-matching "(?<=browser_download_url\": \").*`uname -s`-`uname -m`(?=\")" \
| sudo wget --input-file - --output-document $dc_path
sudo chmod +x $dc_path
}
@mvsde
mvsde / markup.html
Last active Sep 23, 2019
Simple color theme system with Dart Sass
View markup.html
<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 / parseISODate.js
Last active Sep 2, 2019
`new Date()` that works in Safari
View parseISODate.js
/**
* 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 / get-data-type.js
Created Jun 12, 2019
Get JavaScript data type
View get-data-type.js
/**
* 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 / json-stringify.scss
Last active Aug 26, 2019
Naive JSON.stringify() in Sass (handles strings only)
View json-stringify.scss
@function json-stringify ($map) {
$result: '{';
@each $key, $value in $map {
$result: $result + '"#{$key}":';
@if type-of($value) == 'map' {
$result: $result + json-stringify($value);
} @else {
$result: $result + '"#{$value}"';
@mvsde
mvsde / script.sh
Created Feb 21, 2019
Re-enable macOS subpixel antialiasing
View script.sh
defaults write -g CGFontRenderingFontSmoothingDisabled -bool NO
You can’t perform that action at this time.