Skip to content

Instantly share code, notes, and snippets.

View FuruholmAnton's full-sized avatar

Anton Furuholm FuruholmAnton

View GitHub Profile
/**
* Set CSS values on element
*
* @param {any} el
* @param {Object} styles
*/
function css(el, styles) {
if (!el) return;
if (Array.isArray(el) || el instanceof NodeList) {
el.forEach((n) => {
options:
formatter: stylish
files:
include: '**/*.s+(a|c)ss'
rules:
# Extends
extends-before-mixins: 1
extends-before-declarations: 1
placeholder-in-extend: 1
import dashify from 'dashify';
export class Sniffer {
constructor() {
this.init();
Object.keys(this.list).forEach(function(info) {
Object.defineProperty(this, info, {
get: function() {
return this.list[info];
@FuruholmAnton
FuruholmAnton / add_html_to_variable.php
Created April 15, 2021 11:50
Add html to variable
ob_start();
include dirname(plugin_dir_path(__FILE__)) . '/email-template.php';
$html = ob_get_clean();
@FuruholmAnton
FuruholmAnton / Add folder to PATH
Last active May 28, 2024 10:08
[Terminal] #shell
PATH="$PATH:~/opt/bin" # appending
PATH="~/opt/bin:$PATH" # prepending
#!/bin/zsh
@FuruholmAnton
FuruholmAnton / Convert-youtube-short-playlist-to-watch-url.js
Created April 3, 2025 12:32
Extract Shorts from a YouTube playlist and adds a watch link to them that can be embedded on a website.
var els = document.getElementsByClassName('reel-item-endpoint');
var ids = [];
for(i = 0; i < els.length; i++) {
var el = els[i];
if(el) {
if (!el.href || !el.href.match(/shorts\/([a-zA-Z0-9_-]+)$/)) {
continue;
}
ids.push('https://www.youtube.com/watch?v=' + el.href.split('/shorts/')[1].split('/')[0]);
}