Skip to content

Instantly share code, notes, and snippets.

<html>
<body>
<video id="v" width="300" height="300"></video>
<input id="b" type="button" disabled="true" value="Take Picture"></input>
<canvas id="c" style="display:none;" width="300" height="300"></canvas>
</body>
<script>
navigator.getUserMedia({video: true}, function(stream) {
var video = document.getElementById("v");
var canvas = document.getElementById("c");
@musatov
musatov / gulpfile.js
Created February 4, 2016 16:42
Gulp development and production configuration for polymer application written at es6
'use strict';
// Development web-server
const browserSync = require('browser-sync').create();
// Babel plugin for transpiling ES6 code to JS
const babel = require('gulp-babel');
// Tool for separating html and js code
const crisper = require('gulp-crisper');
// Sourcemaps generation for debugin ES6 at browser
const sourcemaps = require('gulp-sourcemaps');
@musatov
musatov / apple-music.playlist-to-string.js
Created May 20, 2020 07:53
Run script on the apple music playlist page console and get list of songs and artists as a string. Resulted string can be used to import the collection to other services like yandex music (https://yandex.ru/support/music/library/import.html)
const elements = Array.from(document.querySelectorAll('.song-name-wrapper'));
const playlist = elements.map(element => {
const nameElement = element.querySelector('.typography-label');
const artistElement = element.querySelector('.typography-caption > a');
const name = nameElement.innerText;
const artist = artistElement.innerHTML;
return `${name} ${artist}`;
});
@musatov
musatov / monoRepoTotalCoverage.js
Created May 20, 2023 14:47
This script automates code coverage reports in a monorepo setup using Jest and Turborepo. It collects and merges data from each package, providing a holistic view of code quality. Assumes a setup with each package outputting coverage data in a 'coverage' folder.
const fs = require('fs')
const path = require('path')
// Params
const pathToPreviousReport = process.argv[2]
// Functions
/**
* Reads the coverage-summary.{XXX}.json file and returns the parsed JSON object
* @param {*} pathToReport
* @returns