Skip to content

Instantly share code, notes, and snippets.

@megabayt
megabayt / matrixToArray.js
Last active April 27, 2022 16:27
May be useful if you need to save empty values
const m = 4;
const n = 3;
const matrix = [
[1, 2],
[3, 4, 5],
[6, 7, 8, 9],
];
const arr = [];
AVURLAsset *textURLAsset;
NSString *textUri = [_textTracks objectAtIndex:i][@"uri"];
if ([[textUri lowercaseString] hasPrefix:@"http"]) {
textURLAsset = [AVURLAsset URLAssetWithURL:[NSURL URLWithString:textUri] options:assetOptions];
} else {
textURLAsset = [AVURLAsset URLAssetWithURL:[self urlFilePath:textUri] options:nil];
}
[textURLAsset loadValuesAsynchronouslyForKeys:@[@"playable",@"tracks"] completionHandler:^{
function longestSubseq(s1, s2) {
const s1Arr = s1.split('');
const s2Arr = s2.split('');
let result = [];
while (s1Arr.length) {
const tmpResult = [];
let startIndex = 0;
s1Arr.forEach((s1Char, index) => {
#!/bin/bash
for i in {1..650}
do
if [ $(curl -LI https://virtualland.ru/rg-semenovskiy-park/flats/1-$i -o /dev/null -w '%{http_code}\n' -s) == "200" ]; then
echo "https://virtualland.ru/rg-semenovskiy-park/flats/1-$i";
fi
done
@megabayt
megabayt / temp.php
Created May 23, 2020 09:01
Временная ссылка
// Генерация временной ссылки
$this->say(
"Вот ссылка на файл ".$file->name.":\n".
URL::temporarySignedRoute(
'download',
now()->addMinutes(2),
['file' => $file->id]
).
"Ссылка будет действовать 2 минуты"
);
function search(obj, value, path = '') {
if (!obj) {
return undefined;
}
if (Array.isArray(obj)) {
let found;
obj.some((item, index) => {
found = search(item, value, `${path}[${index}]`);
return found;
});
if ($('#header .button-ugps span').hasClass('choose-city')) {
$.ajax({
url: '/index.php?route=ugps/city/get&json=Y',
type: 'GET',
dataType: 'json',
error: function() {
return console.error();
},
success: function(res) {
if (res.name !== void 0) {
include_once "library/sxgeo/SxGeo.php";
$sxGeoBase = "library/sxgeo/SxGeoCity.dat";
$sxGeo = new SxGeo($sxGeoBase, SXGEO_BATCH | SXGEO_MEMORY);
$city = $sxGeo->getCity($this->request->server['REMOTE_ADDR'])['city']['name_ru'];