Skip to content

Instantly share code, notes, and snippets.

@astamicu
astamicu / Remove videos from Youtube Watch Later playlist.md
Last active March 27, 2024 22:24
Script to remove all videos from Youtube Watch Later playlist

UPDATED 22.11.2022

It's been two years since the last update, so here's the updated working script as per the comments below.

Thanks to BryanHaley for this.

setInterval(function () {
    video = document.getElementsByTagName('ytd-playlist-video-renderer')[0];

 video.querySelector('#primary button[aria-label="Action menu"]').click();
@mscuthbert
mscuthbert / thingsToCal.scpt
Created June 26, 2016 19:41
Javascript for Automation (JXA) task to take Cultured Code Things Today list tagged with times and put it in calendar
/**
* ThingsToCal -- Copyright (c) 2016 Michael Scott Cuthbert
* Released under a BSD License
*
*/
ObjC.import("stdlib");
class ThingsOrganizer {
constructor() {
@insin
insin / cancellable.js
Last active June 22, 2018 16:55
Cancellable callback wrapper
/**
* Returns a function with a .cancel() function which can be used to prevent the
* given function from being called.
*
* Use case: triggering an asyncronous function with new data while an existing
* function for the same task but with old data is still pending a callback, so
* the callback only gets called for the last one to run.
*/
function cancellable(func) {
var cancelled = false
@hyle
hyle / ko.utils.3.1.0.signatures.js
Created March 5, 2014 08:30
KnockoutJS 3.1.0 utils (ko.utils) signatures
ko.utils.addOrRemoveItem = function (array, value, included) { /* .. */ }
ko.utils.anyDomNodeIsAttachedToDocument = function (nodes) { /* .. */ }
ko.utils.arrayFilter = function (array, predicate) { /* .. */ }
ko.utils.arrayFirst = function (array, predicate, predicateOwner) { /* .. */ }
ko.utils.arrayForEach = function (array, action) { /* .. */ }
@jkp
jkp / websocketserver.py
Created July 18, 2012 13:28
A simple WebSockets server with no dependencies
import struct
import SocketServer
from base64 import b64encode
from hashlib import sha1
from mimetools import Message
from StringIO import StringIO
class WebSocketsHandler(SocketServer.StreamRequestHandler):
magic = '258EAFA5-E914-47DA-95CA-C5AB0DC85B11'
@jeromeetienne
jeromeetienne / dieassert.js
Created May 10, 2012 08:32
a console.assert which actually stop the execution
/**
* A console.assert which actually stop the exectution.
* default console.assert() is a plain display, such as console.log() or console.error();
* It doesnt stop the execution like assert() is meant to do. This is a little code to
* "workaround this limitation" :) thanks @jensarp
*
* Usage:
* console.assert(foo === bar); // Will throw if not equal
* console.assert(foo === bar, 'Dude, foo does not equal bar'); // Will throw with custom error message
*