This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--mpv.conf -> input-ipc-server=/tmp/mpvsocket | |
--$ echo 'script-message addscrollingsub "hello world"' | socat - /tmp/mpvsocket | |
local assdraw = require("mp.assdraw") | |
local utils = require("mp.utils") | |
local settings = { | |
ass_style = "\\1c&HC8C8B4\\fs33\\bord2", | |
speed = 0.3 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Sans-serif system fonts look good and do not need to be loaded by the visitor! */ | |
body { | |
font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif; | |
} | |
/* | |
For serif and monospace: | |
font-family: "Apple Garamond", "Baskerville", "Times New Roman", "Droid Serif", "Times","Source Serif Pro", serif; | |
font-family: "SF Mono", "Monaco", "Inconsolata", "Fira Mono", "Droid Sans Mono", "Source Code Pro", monospace; | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Two way key value store. | |
* When you want to get key with value or value with a key. | |
* | |
* examples: | |
* var store = twoWayKeyValueStore([ [200, "ok"], [401, "unauthorized"] ]) | |
* store.get(401) // "unauthorized" | |
* store.get("unauthorized") // 401 | |
* store.set(200, "ok").get("ok") // 200 | |
* store.remove("ok").get(200) // undefined |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function createStack() { | |
let head = null | |
let length = 0 | |
return { | |
push: (data) => { | |
head = { data, next: head } | |
length++ | |
}, | |
pop: () => { | |
if (head === null) return null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function iterableStack() { | |
let arr = [] | |
return { | |
push: (data) => arr.push(data), | |
pop: () => arr.pop(), | |
[Symbol.iterator]: function* () { | |
let index = 0 | |
while (arr[index]) { | |
yield arr[index] | |
index++ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Node(value, parent, left, right) { | |
this.value = value | |
this.left = left || null | |
this.right = right || null | |
this.parent = parent || null | |
this.height = () => { | |
const lefth = this.left ? this.left.height() : -1 | |
const righth = this.right ? this.right.height() : -1 | |
if (lefth > righth) { | |
return lefth + 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function binaryArray(arr) { | |
const array = arr | |
const find = (searchvalue) => { | |
let middle = Math.floor(array.length / 2) | |
let left = 0 | |
let right = array.length | |
while (right >= left) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Stack() { | |
let arr = [] | |
return { | |
push: (data) => arr.push(data), | |
pop: () => arr.pop(), | |
show: () => arr | |
} | |
} | |
function calc(string, showstack) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- resolve_ytdl helper command: https://gist.github.com/jonniek/4a9d850d224bbd704b71f9ec882eeef6 | |
-- copy it and add it to some path dir and update the below path to match | |
local resolver = '/usr/bin/resolve_ytdl' | |
local tmpfile = '/tmp/resolvedtitle' | |
local utils = require("mp.utils") | |
local processed_urls = {} | |
local resolved_urls = {} | |
mp.observe_property('playlist-count', "number", function() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function setNativeValue(element, value) { | |
const valueSetter = Object.getOwnPropertyDescriptor(element, 'value').set; | |
const prototype = Object.getPrototypeOf(element); | |
const prototypeValueSetter = Object.getOwnPropertyDescriptor(prototype, 'value').set; | |
if (valueSetter && valueSetter !== prototypeValueSetter) { | |
prototypeValueSetter.call(element, value); | |
} else { | |
valueSetter.call(element, value); | |
} |