This file contains hidden or 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
import React, { Component } from "react"; | |
import VideoPlayer from "./VideoPlayer"; | |
class App extends Component { | |
constructor(props) { | |
super(props); | |
this.createVisualization = this.createVisualization.bind(this); | |
} |
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> |
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> |
This file contains hidden or 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
if(!Array.prototype.filter){ | |
Array.prototype.filter = (fn) => { | |
let res = [] | |
let length = this.length | |
for(let i=0; i < length; i++) { | |
if(fn(this[i])) { | |
res.push(this[i]) | |
} | |
} | |
return res; |
This file contains hidden or 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
const throttle = (fn, delay) => { | |
let lastRan; | |
let timerId; | |
return function() { | |
const ctx = this; | |
const args = arguments; | |
if(!lastRan){ | |
fn.apply(ctx, args) | |
lastRan = Date.now(); | |
} else { |
This file contains hidden or 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
const debounced = (fn, delay) => { | |
let timerId = null; | |
return function() { | |
const args = arguments; | |
const ctx = this; | |
console.log("Trying....") | |
clearTimeout(timerId) | |
timerId = setTimeout(() => { | |
fn.apply(ctx, args) | |
}, delay) |
This file contains hidden or 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
// Main Memoize function | |
const memo = fn => { | |
const cache = {} | |
return function () { | |
const key = JSON.stringify(arguments); | |
if(key in cache){ | |
return cache[key] | |
} else { | |
cache[key] = fn.apply(this, arguments); | |
return cache[key] |
This file contains hidden or 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
const arr = [1, 2, 3, 4, 5, 6, 7, 8, 9] | |
function getRandomInt(max) { | |
return Math.floor(Math.random() * Math.floor(max)); | |
} | |
console.log("Initial Array", arr); | |
for(let i = (arr.length - 1); i > 0; i--){ | |
const randI = getRandomInt(i); |
This file contains hidden or 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
import React from 'react'; | |
import ProgressiveImage from 'react-progressive-graceful-image'; | |
import styled from 'styled-components'; | |
const PlcHolder = styled.img` | |
background: linear-gradient( | |
to right, | |
rgb(246, 247, 248) 0%, | |
rgb(237, 238, 241) 20%, | |
rgb(246, 247, 248) 40%, |
This file contains hidden or 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
{"lastUpload":"2020-11-17T10:07:07.220Z","extensionVersion":"v3.4.3"} |