Skip to content

Instantly share code, notes, and snippets.

View s-melnikov's full-sized avatar

Sehii Melnykov s-melnikov

View GitHub Profile
<?php
$params = [];
if ($_POST["firstname"]) {
$params["firstname"] = $_POST["firstname"];
}
if ($_POST["lastname"]) {
$params["lastname"] = $_POST["lastname"];
}
var
elements = document.querySelectorAll('.s-box'),
docWidth,
docHeight,
docRatio;
elements = Array.prototype.slice.call(elements);
function onresize() {
// ширина и высота документа
function xml(params) {
var doc;
function node(parent, params) {
if (!doc) {
doc = document.implementation.createDocument("", params.name, null);
el = doc.documentElement;
} else {
var el = doc.createElement(params.name);
parent.appendChild(el);
}
function request(method, url, data, callback) {
var xhttp = new XMLHttpRequest()
xhttp.open(method, url, true)
xhttp.setRequestHeader("Content-type", "application/json")
if (callback) {
xhttp.onload = function() {
if (xhttp.status >= 200 && xhttp.status < 400) {
try {
callback(null, JSON.parse(xhttp.responseText))
} catch(e) {
function hostname(u) {
var a = document.createElement('a');
a.href = u;
return a.hostname;
}
$('.page_2').bind('inview', function(event, visible, visiblePartX, visiblePartY) {
if (visible) {
if ($('.percentage').data('easyPieChart')) {
var percentage = $('.percentage'),
chart1 = percentage.eq(0).data('easyPieChart'),
chart2 = percentage.eq(0).data('easyPieChart');
chart1.options.animate = chart2.options.animate = 0;
function isTouchDevice() {
return !!("ontouchstart" in window);
}
if (isTouchDevice()) {
// если мобильное устройство (тач устройство)
}
if (!isTouchDevice()) {
// если не мобильное устройство
<?php
// массив для результата выборки
$data = array();
if (isset($_POST['filter'])) {
foreach ($_POST['info_department'] as $selected) {
$sql = "SELECT * FROM info WHERE info_department = '$selected' ORDER BY info_id DESC";
$result = $connect->query($sql);
$result_array = $result->fetch_all(MYSQLI_ASSOC);
<body>
<h1>Acme community</h1>
<forum-header/>
<forum-content>
<forum-threads/>
<forum-sidebar/>
</forum-content>
var params = { test: "Hello World!" };
var base64str = btoa(JSON.stringify(params)); // "eyJ0ZXN0IjoiSGVsbG8gV29ybGQhIn0="
JSON.parse(atob(base64str)).test // "Hello World!"