Skip to content

Instantly share code, notes, and snippets.

View FuruholmAnton's full-sized avatar

Anton Furuholm FuruholmAnton

View GitHub Profile
@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]);
}
#!/bin/zsh
@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
@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();
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];
options:
formatter: stylish
files:
include: '**/*.s+(a|c)ss'
rules:
# Extends
extends-before-mixins: 1
extends-before-declarations: 1
placeholder-in-extend: 1
/**
* 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) => {
/**
* Bind methods
* ex. bind(this, 'onClick', 'setHeight');
*
* @param {Object} self
* @param {string} functions
*/
function bind(self, ...functions) {
functions.forEach((name) => {
self[name] = self[name].bind(self);
/**
* Serializes the object and arrays and objects of the main object.
*
* @param {Object} data - the object to serialize
* @param {String} prefix - used internally to keep track of the nesting
*/
function deepSerialize(data, prefix = '') {
if (typeof data == 'function') return prefix != '' ? prefix + '=null' : '';
const array = [];
@FuruholmAnton
FuruholmAnton / webpack.config.js
Last active February 24, 2017 18:10
Webpack for JS, SCSS with PHP as a backend
"use strict";
var webpack = require('webpack');
const path = require('path');
var loaders = require('./tools/webpack.loaders');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var DashboardPlugin = require('webpack-dashboard/plugin');
var BrowserSyncPlugin = require('browser-sync-webpack-plugin');
require("babel-polyfill");