Skip to content

Instantly share code, notes, and snippets.

View gkatsev's full-sized avatar

Gary Katsevman gkatsev

View GitHub Profile
function bar(x) {
"use strict";
switch (x) {
case 1:
let foo = 5;
console.log(foo);
case 2:
foo = 6;
return console.log(foo);
@gkatsev
gkatsev / index.js
Created December 19, 2014 17:11
requirebin sketch
var vjs = require('video.js');
var doc = require('global/document');
var video = doc.createElement('video');
video.src = 'http://vjs.zencdn.net/v/oceans.mp4';
var link = doc.createElment('link');
link.href = 'http://vjs.zencdn.net/4.11/video-js.css';
link.rel = 'stylesheet';
@gkatsev
gkatsev / prop.md
Created December 8, 2014 19:58
proposals for new/additional APIs for text tracks
  • Available API

    • addTextTrack(kind [, label [, language]]);
  • Additional API

    • removeTrack(track);
  • proposals

    • addRemoteTrack(options);
  • options

vjs.EventEmitter = function() {
};
vjs.EventEmitter.prototype.allowedEvents_ = {
};
vjs.EventEmitter.prototype.on = function(type, fn) {
vjs.on(this, type, fn);
};
@gkatsev
gkatsev / process-all.js
Last active November 4, 2022 18:03
Simple captions with vtt.js and a sample video.
var video = document.querySelector('video');
var caption = video.querySelector('track[kind=captions]');
var captionsArea = document.querySelector('.captions-area');
var captionsDisplay = document.querySelector('.captions-display');
var xhr = new XMLHttpRequest();
xhr.open('GET', caption.src);
xhr.onreadystatechange = function() {
if (xhr.readyState === 4) {
`--> make all
gcc shovel.c `js24-config --cflags --libs` -o shovel.bin -O3 -Werror -Wunused
In file included from /usr/include/mozjs-24/mozilla/Casting.h:12:0,
from /usr/include/mozjs-24/mozilla/FloatingPoint.h:13,
from /usr/include/mozjs-24/jsapi.h:12,
from shovel.c:2:
/usr/include/mozjs-24/mozilla/TypeTraits.h:19:1: error: unknown type name ‘namespace’
namespace mozilla {
^
/usr/include/mozjs-24/mozilla/TypeTraits.h:19:19: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token

Mid-segment switching

Things to aim for

  • turn the in-memory buffer from segments to tags
  • in drainBuffer, seed in enough tags so that 1s (less? more?) of content is in there, with at least a delta of one keyframe
  • when new segments arrive, replace overlapping tags in the in-memory buffer
    • never replace tags in previous discontinuities

Equations

smartctl 6.2 2013-07-26 r3841 [x86_64-linux-3.13.0-35-generic] (local build)
Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF INFORMATION SECTION ===
Model Family: SandForce Driven SSDs
Device Model: OCZ-AGILITY3
Serial Number: OCZ-P4WNM1M2SPF1536W
LU WWN Device Id: 5 e83a97 e370c5b95
Firmware Version: 2.15
User Capacity: 120,034,123,776 bytes [120 GB]
@gkatsev
gkatsev / better
Last active August 29, 2015 14:05
function foo(err, key) {
if (err) {
return console.error(err);
}
var someKey = key;
var somethingElse = something(someKey);
doSomethingElse(somethingElse);
}
@gkatsev
gkatsev / gist:6be3e990c5e808e88f37
Last active August 29, 2015 14:02
Got the following after an `npm install -g npm`.
0 info it worked if it ends with ok
1 verbose cli [ 'node',
1 verbose cli '/Users/gkatsevman/.nvm/v0.10.28/bin/npm',
1 verbose cli 'install',
1 verbose cli '-g',
1 verbose cli 'npm' ]
2 info using [email protected]
3 info using [email protected]
4 verbose cache add [ 'npm', null ]
5 verbose cache add name=undefined spec="npm" args=["npm",null]