Skip to content

Instantly share code, notes, and snippets.

View AndrewBuntsev's full-sized avatar

Andrei Buntsev AndrewBuntsev

View GitHub Profile
function UploadVideo(file) {
var loaded = 0;
var chunkSize = 500000;
var total = file.size;
var reader = new FileReader();
var slice = file.slice(0, chunkSize);
// Reading a chunk to invoke the 'onload' event
reader.readAsBinaryString(slice);
console.log('Started uploading file "' + file.name + '"');
<div id="uploadVideoProgressBar" style="height: 5px; width: 1%; background: #2781e9; margin-top: -5px;"></div>
$('#uploadVideoProgressBar').width(percentLoaded + "%");
<html>
<body>
<script>
function createString() {
return "0".repeat(25 * 1024 * 1024).substring(0, 12);
}
var arr = [];
setInterval(function() {
let str = createString();
arr.push(str);
return "0".repeat(25 * 1024 * 1024).substring(0, 13);
<html>
<body>
<script>
function createString() {
return "0".repeat(25 * 1024 * 1024).substring(0, 12);
}
var arr = [];
setInterval(function() {
let str = createString().split('').join('');
arr.push(str);
['1', '7', '11'].map(parseInt);
['1', '7', '11'].map(parseFloat);
['1', '7', '11'].map(i => parseInt(i));
['1', '7', '11'].map((val, index, arr) => parseInt(val, index, arr));