This file contains 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 Parser{ | |
public $responseArr = []; | |
function __construct($url) | |
{ | |
$this->url = $url; | |
} |
This file contains 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 | |
**************************************/ | |
<?php | |
$re = '/<tr>(.+?)<\/tr>/ms'; | |
$re_td = '/<td[^>].*?>(.*?)<\/td>/ms'; | |
$str = '<table> | |
<tbody> | |
<tr> |
This file contains 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
https://javascript.ru/php | |
http://locutus.io/php/ | |
/*********************** | |
range | |
https://dev.to/ycmjason/how-to-create-range-in-javascript-539i | |
***********************/ | |
function range(start, end) { | |
var ans = []; | |
for (let i = start; i <= end; i++) { |
This file contains 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 | |
usage() { echo "Manual: $0 [-c <string> -f <path>]" 1>&2; exit 1; } | |
while getopts ":c:f:" o; do | |
case "${o}" in | |
c) | |
c=${OPTARG} | |
;; | |
f) |
This file contains 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
/************ | |
скрыть/показать пароль | |
без всяких крутых вещей. Главный принцип | |
**************/ | |
<input type="password" id="password"> | |
<input type="checkbox" onchange="document.getElementById('password').type = this.checked ? 'text' : 'password'"> Show password | |
// и второй вариант. На Jquery пока не переделал | |
$('.show-key').click(function() { | |
document.getElementById('api_key').type = "text"; |
This file contains 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
/************ выделения пункта меню при активном якоре **************/ | |
//http://jsfiddle.net/bonilka/p7sgwg4L/ | |
<script> | |
jQuery(window).scroll(function(){ | |
var $sections = $('div'); | |
$sections.each(function(i,el){ | |
var top = $(el).offset().top-100; | |
var bottom = top +$(el).height(); | |
var scroll = $(window).scrollTop(); | |
var id = $(el).attr('id'); |
This file contains 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
//https://impuls-web.ru/css-xaki-kak-zadat-css-stili-dlya-raznyx-brauzerov/ | |
/* стили для мозилы */ | |
_:-moz-any-link, :root .new_wid{width: 70% !important;} | |
/* стили для хрома */ | |
_:-webkit-any-link, :root .new_wid{width: 70% !important;} | |
/**** стили для разных размеров окна браузера ***/ | |
@media screen and (min-width: 1628px){ | |
.ting-product__text{ |
This file contains 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 sendRequest($url, array $params = [], $post = false){ | |
$curl = curl_init(); | |
$headers = array( | |
'Content-Type: application/json-patch+json', | |
'accept: application/json', | |
); | |
if ($post == true) { |
This file contains 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 | |
/************** | |
класс чтения и записе csv файла | |
***************/ | |
/********************** | |
Иногда при просмотре csv файла в эксель, выходит странная кодровка. Дело не в самой кодировки файла, а в отсутствие одной опции. | |
fprintf ( $ fp , chr ( 0xEF ). chr ( 0xBB ). chr ( 0xBF )); | |
В общем виде выглядит это так | |
$fp = fopen("путь", 'r+'); |
This file contains 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 | |
/****************** удаляем из массива ******************/ | |
//массив из которого нужно удалить | |
$letters = array('(', ')', '[', ']', '{', '}','h', 'r','ff'); | |
//массив данных, которые не трогаем | |
$no_delete = array('(', ')', '[', ']', '{', '}'); | |
foreach($letters_new as $key => $char){ |