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 getCheckFunction = (params, isAnd) => { | |
const action = isAnd ? "every" : "some"; | |
const entries = Object.entries(params); | |
return (object) => { | |
return entries[action](([key, value]) => object[key] === value); | |
}; | |
}; | |
const filter = (array, params, isAnd) => { | |
return array.filter(getCheckFunction(params, isAnd)); |
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 { useCallback, useRef } from "react"; | |
const Elem = ({ index, onClick }) => { | |
const onClickRef = useRef(onClick); | |
const handleEvent = useCallback(() => { | |
onClickRef.current(index); | |
}, [index, onClickRef]); | |
return <button onClick={handleEvent}>{index}</button>; | |
}; |
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
#!/bin/bash | |
# Run without args to see usage | |
##### Configuration ##### | |
# Maximum shakiness and accuracy | |
DETECT_OPTS="shakiness=10:accuracy=15" | |
# Fish-eye correction for GoPro H3+B 16:9 Wide | |
# http://stackoverflow.com/questions/30832248/is-there-a-way-to-remove-gopro-fisheye-using-ffmpeg/40659507#40659507 |
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
// set and get value from href | |
function hrefValue (key, value) { | |
'use strict'; | |
var result, | |
regexp, | |
replacer, | |
href = window.location.href; | |
regexp = new RegExp(key + '=([^\;\&\n]+)'); | |
replacer = function (match, val) { | |
return match.replace(val, value); |
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
// SHOW BY CLICK | |
// | |
// This self-invoking function returns init function. If you dynamicly modify or add new DOM structure, you can easyly run plugin for new elements. | |
// Init function needs one argument. Argument can be a DOM node or jQuery object containing element(s) for init. | |
// Basicly you can change selector by changing "selector" variable. Also you can give your dynamicly created trigger elements a className by changing "triggerClass" variable. | |
// In the "triggerText" array you can find text for trigger nodes or set it by adding custom "data-show-text" and "data-hide-text" attributes | |
// Please send BUG reports or any proposals to [email protected] | |
;(function showByClick ($) { | |
if (!$) { |
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
function c (text, type, condition) { | |
// made console messages simple | |
var t; | |
if (type) { | |
switch (type) { | |
case 1: | |
t = 'info'; | |
break; | |
case 2: | |
t = 'warn'; |