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
function params(str) { | |
var res = {}; | |
(str || location.search).replace(/^\?/, "").split("&").forEach(function(str) { | |
str = str.split("="); | |
res[str[0].toLowerCase()] = str[1] || true; | |
}); | |
return res; | |
} |
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
function query(obj) { | |
var str = ""; | |
for (var prop in obj) { | |
str && (str += "&") || (str = "?"); | |
if (obj.hasOwnProperty(prop)) str += prop + "=" + obj[prop]; | |
} | |
return str; | |
} |
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
var params = { test: "Hello World!" }; | |
var base64str = btoa(JSON.stringify(params)); // "eyJ0ZXN0IjoiSGVsbG8gV29ybGQhIn0=" | |
JSON.parse(atob(base64str)).test // "Hello World!" |
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
<body> | |
<h1>Acme community</h1> | |
<forum-header/> | |
<forum-content> | |
<forum-threads/> | |
<forum-sidebar/> | |
</forum-content> |
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 | |
// массив для результата выборки | |
$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); |
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
function isTouchDevice() { | |
return !!("ontouchstart" in window); | |
} | |
if (isTouchDevice()) { | |
// если мобильное устройство (тач устройство) | |
} | |
if (!isTouchDevice()) { | |
// если не мобильное устройство |
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
$('.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; |
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
function hostname(u) { | |
var a = document.createElement('a'); | |
a.href = u; | |
return a.hostname; | |
} |
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
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) { |
OlderNewer