Skip to content

Instantly share code, notes, and snippets.

View ravenjohn's full-sized avatar
🏡
Working from home

Raven ravenjohn

🏡
Working from home
View GitHub Profile
@ravenjohn
ravenjohn / tabled_devices.js
Created August 10, 2023 06:31
Output devices on a table
navigator.mediaDevices.enumerateDevices()
.then(devices => devices.filter(dev => dev.deviceId && dev.kind === 'audioinput'))
.then(devices => devices.map((device) =>
navigator.mediaDevices.getUserMedia({
audio: {
deviceId: {
exact: device.deviceId
},
}
})
@ravenjohn
ravenjohn / video_frame_format.js
Last active April 4, 2023 18:00
Get VideoFrame format
(() => {
// change value of querySelector to whatever is needed to select the element, e.g. #my-canvas, #my-video
const el = document.querySelector('canvas');
const stream = el.captureStream(30);
const track = stream.getVideoTracks()[0];
const { readable } = new MediaStreamTrackProcessor({ track });
const reader = readable.getReader();
const read = async () => {
const { done, value} = await reader.read();
@ravenjohn
ravenjohn / spamToMasterRank.md
Last active March 16, 2018 15:09
A simple script that calculates how many months you should spam a hero to reach level 25 (master rank).

How many months will it take for me to reach master rank if I play the same hero?

image

Instructions

  1. Go to your dotabuff profile, and go to Activity tab. The URL should look like https://www.dotabuff.com/players/<YOUR_ID>/activity
  2. Open console and execute the following code (Ctrl + Shift + J for windows) by copy-pasting:
// This variable will remove weeks where you played games less than this number.
// note: change this if you want.
@ravenjohn
ravenjohn / search_global_vars.js
Created March 5, 2015 19:42
Search `user` on `this`
var search = 'user',
on = this,
max_depth = 30,
found = [],
recurse = function (obj, from, depth) {
var i;
if (depth >= max_depth) {
return;
@ravenjohn
ravenjohn / konflik_chkr.js
Last active December 26, 2015 09:58
Conflict checker
(function(root){
/**
* Section Object
*
* @param object from the database
*/
root.Section = function (o) {
var _s = this,
initMeta = function (a, b, c, d, e) {
return {