Skip to content

Instantly share code, notes, and snippets.

View radzev1ch's full-sized avatar

Aliaksandr Radzevich radzev1ch

  • Belarus
View GitHub Profile
@radzev1ch
radzev1ch / splitprice.php
Created April 6, 2017 14:52
split price with regular expression
<span class="price">
<?php $regex = '/(от\s)?(\d+[,.]?\d+)(\s.*)/'; ?>
<span class="price__price"><?php echo preg_replace($regex,'$1$2',$str)) ?></span>
<span class="price__unit"><?php echo preg_replace($regex,'$3',$str)) ?></span>
</span>
@radzev1ch
radzev1ch / getremotejson.php
Created April 4, 2017 16:55
get json from url
<?php
$url = '';
function getStatus($v)
{
$headers = get_headers($v);
if (!$headers)
{
@radzev1ch
radzev1ch / removespaces.js
Created April 3, 2017 10:03
remove spaces from the beginning and end of string
/(^\s+)(.+)(\s+$)/
@radzev1ch
radzev1ch / parseSvg.js
Last active April 2, 2017 13:39
append svg with js
var sMyString = '<svg fill="#000000" height="36" viewBox="0 0 24 24" width="36" xmlns="http://www.w3.org/2000/svg"><path d="M0 0h24v24H0z" fill="none"/><path d="M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z"/></svg>';
var oParser = new DOMParser();
var oDOM = oParser.parseFromString(sMyString, "text/xml");
// insert
node.appendChild(oDOM.documentElement);
@radzev1ch
radzev1ch / tooltip.js
Created September 5, 2016 13:08
disabled tooltip joomla
jQuery.fn.tooltip = function (option) { };
/**
* TableSorter customise
* hompage http://tablesorter.com/
*
* verison 0.0.1
* Copyright 2016 by Rasy
*/
var $table = $('.table');
var $link_sort = $('.link-sort');
/**
* TableSorter customise
* hompage http://tablesorter.com/
*
* verison 0.0.3
* Copyright 2016 by Rasy
*/
var $table = $('.table');
var $tr = $table.find('tr').not(':eq(0)');
@radzev1ch
radzev1ch / table-sorter-custom.js
Last active August 10, 2016 07:11
table sorter customise
/**
* TableSorter customise
* hompage http://tablesorter.com/
*
* verison 0.0.1
* Copyright 2016 by Rasy
*/
var $table = $('.table');
var $link_sort = $('.link-sort');
@radzev1ch
radzev1ch / phonechange1.js
Last active July 26, 2016 09:56
phone change from referrer
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>phonechange</title>
</head>
<body>
<div class="tel ptsans">
<div class="phones" id="phone">
@radzev1ch
radzev1ch / location.js
Created May 2, 2016 07:54
window location
window.addEventListener('DOMContentLoaded', function () {
var product = document.querySelectorAll('.block-product'),
link = document.querySelectorAll('.button-detail'),
target = [];
for (var i = 0; i < link.length; i++) {
target.push(link[i].href);
}
console.log(target)