Skip to content

Instantly share code, notes, and snippets.

@AgentOak
AgentOak / youtube_formats.md
Last active April 27, 2024 04:15
Youtube Format IDs

Last updated: April 2021

Also known as itag or format codes and way back they could be specified with the fmt parameter (e.g. &fmt=22). Depending on the age and/or popularity of the video, not all formats will be available.

DASH video

Resolution AV1 HFR High AV1 HFR AV1 VP9.2 HDR HFR VP9 HFR VP9 H.264 HFR H.264
MP4 MP4 MP4 WebM WebM WebM MP4 MP4
/**
* JS scoping, and this property resolutions rules in ES7/ES8.
*
* Quiz: x is gone, and x is everywhere!
*
* Help find Xs! What's the output?
*/
let x = 1;
@ebidel
ebidel / coverage.js
Last active April 27, 2024 04:13
CSS/JS code coverage during lifecycle of page load
Moved to https://github.com/ebidel/puppeteer-examples
@jmshal
jmshal / coverage.js
Created February 26, 2018 21:41 — forked from ebidel/coverage.js
CSS/JS code coverage during lifecycle of page load
/**
* @author ebidel@ (Eric Bidelman)
* License Apache-2.0
*
* Shows how to use Puppeeteer's code coverage API to measure CSS/JS coverage across
* different points of time during loading. Great for determining if a lazy loading strategy
* is paying off or working correctly.
*
* Install:
* npm i puppeteer chalk cli-table
@jmshal
jmshal / atob.js
Last active April 27, 2024 04:12
Node.js ponyfill for atob and btoa encoding functions
module.exports = function atob(a) {
return new Buffer(a, 'base64').toString('binary');
};
@joshisa
joshisa / URL Parsing
Created February 3, 2017 02:27
Parsing of URLs using bash sh scripting
#!/bin/bash
# Referenced and tweaked from http://stackoverflow.com/questions/6174220/parse-url-in-shell-script#6174447
proto="$(echo $1 | grep :// | sed -e's,^\(.*://\).*,\1,g')"
# remove the protocol
url="$(echo ${1/$proto/})"
# extract the user (if any)
userpass="$(echo $url | grep @ | cut -d@ -f1)"
pass="$(echo $userpass | grep : | cut -d: -f2)"
if [ -n "$pass" ]; then
@bellbind
bellbind / main.js
Last active April 27, 2024 04:12
[electron] Tray launcher example
"use strict";
// [run the app]
// $ npm install electron
// $ ./node_modules/.bin/electron .
const {app, nativeImage, Tray, Menu, BrowserWindow} = require("electron");
let top = {}; // prevent gc to keep windows
@sylvaindethier
sylvaindethier / server.js
Created June 26, 2017 09:36
NodeJS Express server for SPA
// Express
const express = require('express');
const bodyParser = require('body-parser');
const path = require('path');
const PORT = 9000;
const STATIC = path.resolve(__dirname, 'dist');
const INDEX = path.resolve(STATIC, 'index.html');
@Saccarab
Saccarab / merge-ffmpeg.js
Created June 9, 2019 08:54
fluent-ffmpeg merge audio with video
const command = ffmpeg()
const commandArray = []
command.addInput(`./best.mp4`)
command.addInput(`./best2.wav`)
commandArray.push(`[1]volume=0.1[a1]`)
command.addInput(`./voiceover.mp3`)
commandArray.push(`[2]volume=0.9[a2]`)
let ffmpegKeys = '[a1][a2]amix=inputs=2[a]'
commandArray.push(ffmpegKeys)
@luciopaiva
luciopaiva / _Full-socketio-client-and-server-example.md
Last active April 27, 2024 04:09
Full socket.io client and server example

Full socket.io client and server example

Last updated: 2021-02-21, tested with socket.io v3.1.1

This is the simplest implementation you will find for a client/server WebSockets architecture using socket.io.

To see a full explanation, read my answer on SO here: https://stackoverflow.com/a/24232050/778272.

If you're looking for examples using frameworks, check these links: