Skip to content

Instantly share code, notes, and snippets.

@codingfox-rus
codingfox-rus / getCookieName.js
Last active August 29, 2015 14:11
Получение куки по имени (JS)
function getCookie(name) {
var matches = document.cookie.match(new RegExp(
"(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)"
));
return matches ? decodeURIComponent(matches[1]) : undefined;
}
@codingfox-rus
codingfox-rus / Time-counter.html
Last active August 29, 2015 14:05
Простейший счетчик обратного отсчета (дни-часы-минуты-секунды). Может использоваться в лендингах как заготовка
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Счетчик обратного отсчета</title>
<style>
#container {
margin: 0 auto;
width: 30%;
}
@codingfox-rus
codingfox-rus / PHP-mail-example.php
Last active August 29, 2015 14:02
PHP mail() example with attached file
<?php
# получаем данные и отсекаем пробельные символы в начале и конце:
$name = @ trim ($_POST['your-name']);
$email = @ trim ($_POST['your-email']);
$fileName = $_FILES['file-rezume']['name'];
if ( isset($_POST['your-message']) ) {
$userMessage = @ trim ($_POST['your-message']);
} else {
$userMessage = "";
}