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
// web telegram stream video from cache | |
// it probably uses shared/webworkers to save bytes chunks into cache storage | |
// so once video is fully cached it could be saved from cache to device | |
// browser could ask to allow parallel files downloads from web telegram domain, just allow it | |
(async function downloadCachedVideos() { | |
// global downloaded set is to prevent downloading videos were alreadt downloaded | |
window.downloaded = window.downloaded || new Set([]) | |
function saveVideo(outname, dataArray) { | |
console.log(`Start downloading ${outname} with ${dataArray.length} chunks`) |
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, { useEffect, useState } from "react"; | |
import { render } from "react-dom"; | |
import generateRandomWord from "random-words"; | |
interface Data { | |
id: string; | |
data: string; | |
} | |
const DATA_CHUNK = 10; |
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 original = [1, 0, 0, 0, 1, 1, 0]; | |
const relations = { | |
1: [1, 2, 6], | |
2: [1, 2], | |
3: [3, 5], | |
4: [4, 5, 6], | |
5: [3, 4, 5], | |
6: [1, 4, 6], | |
}; |
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 throttle from 'lodash/throttle'; | |
class Component { | |
someSectionRef = null; | |
componentDidMount() { | |
// check window object existing, to not listen events in SSR | |
if(window) { | |
window.addEventListener('scroll', this.onScroll); | |
} |
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
type ScrollDirection = 'vertical' | 'horizontal' | 'both'; | |
/** | |
* It prevents default behaviour above the scrollable areas | |
* until it's in available scrollable direction. | |
* | |
* Example of checkScrollableElement: | |
* | |
* var cleanBlocking = ( | |
* blockOverScroll( |
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
<?php | |
class YADWord { | |
private static $bind_region = array(); | |
private static $bind_crc = array(); | |
public $region_id = 213; | |
public $original; |
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
<?php | |
/** | |
* Remove from string all invalid characters | |
* Leave only English, Russian, Turkish, Kazakh and Numbers | |
* @link http://www.unicode.org/charts/ | |
* @param string $w | |
* @return string | |
*/ | |
function prepareSearchKeyword($w){ |
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
# Bitrix Example | |
RewriteEngine On | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-l | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteCond %{REQUEST_FILENAME} !/bitrix/urlrewrite.php$ | |
RewriteRule ^(.*)$ /bitrix/urlrewrite.php [L] | |
#RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization}] | |
RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization},E=HTTP_IF_MODIFIED_SINCE:%{HTTP:If-Modified-Since}] |
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
<?php | |
function test($str){ | |
list($var) = explode('/', $str); | |
return $var; | |
} | |
function test2($str){ | |
$var = array_shift(explode('/', $str)); | |
return $var; |
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
javascript:(function(script){script.setAttribute('src','https://rawgit.com/ivansky/cssrefresh.js/master/cssrefresh.min.js');var head=document.querySelector('head').appendChild(script);})(document.createElement('script')); |
NewerOlder