Skip to content

Instantly share code, notes, and snippets.

@eivko
eivko / .htaccess
Last active July 11, 2016 20:28
Кэш ресурсов в браузере на месяц через .htaccess
<FilesMatch ".(flv|gif|jpg|jpeg|png|ico|swf|js|css|pdf|woff|eot|ttf)$">
Header set Cache-Control "max-age=2592000"
</FilesMatch>
@eivko
eivko / volume-calc-form.html
Last active December 14, 2017 11:35
Калькулятор объёма на jQuery
<form>
<input type="number" min="0" name="a" placeholder="a" />
<input type="number" min="0" name="b" placeholder="b" />
<input type="number" min="0" name="c" placeholder="c" />
<input type="number" min="0" name="qt" placeholder="Количество коробок" />
<div class="calc-result"></div>
<input type="button" name="send" value="Рассчитать" />
</form>
@eivko
eivko / 1200px.viewport.html
Created July 11, 2016 20:34
1200px viewport (неадаптивный)
<meta name="viewport" content="width=1200px, initial-scale=0.3, maximum-scale=1.0, user-scalable=yes">
@eivko
eivko / theme.meta.head.html
Last active July 16, 2016 20:31
Цвет адресной строки и статус-бара на мобильных
<!-- Chrome, Firefox OS and Opera -->
<meta name="theme-color" content="#4285f4">
<!-- Windows Phone -->
<meta name="msapplication-navbutton-color" content="#4285f4">
<!-- iOS Safari -->
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
@eivko
eivko / form-send.ajax.js
Created January 28, 2017 09:02
Отправка AJAX-формы
$(function() {
$('form').submit(function(e) {
var $form = $(this);
$.ajax({
type: $form.attr('method'),
url: $form.attr('action'),
data: $form.serialize()
}).done(function() {
console.log('success');
}).fail(function() {
@eivko
eivko / head.modx.html
Created March 16, 2017 10:43
Заголовок в MODX (если не пустой, вставляется longtitle
<title>[[*longtitle:isnot=``:then=`[[*longtitle]]`:else=`[[*pagetitle]]`]]</title>
@eivko
eivko / context.audio.js
Created June 3, 2017 09:26
Подключение контекста Web Audio API
var context;
window.addEventListener('load', function(){
try {
window.AudioContext = window.AudioContext||window.webkitAudioContext;
context = new AudioContext();
}
catch(e) {
alert('Ваш браузер не поддерживает Web Audio API');
}
}, false);
@eivko
eivko / replace.sql
Created August 3, 2017 14:19
найти и заменить часть содержимого таблицы
UPDATE articles SET text = REPLACE(text, '8-927-123-45-67', '8-927-123-76-54') WHERE text LIKE '%8-927-123-45-67%'
@eivko
eivko / seo.meta.head.modx.html
Last active September 21, 2017 09:30
modx meta seo
<title>[[*longtitle:default=`[[*pagetitle]]`]]</title>
<meta name="description" content="[[*description]]">
<meta name="keywords" content="[[*keywords]]">
@eivko
eivko / pdomenu.bootstrap.modx
Created October 17, 2017 05:56
pdomenu.bootstrap.modx
[[pdoMenu?
&level=`2`
&parents=`0`
&outerClass=`nav navbar-nav`
&tplOuter=`@INLINE <ul [[+classes]] id="menu">[[+wrapper]]</ul>`
&tplInner=`@INLINE <ul class="dropdown-menu">[[+wrapper]]</ul>`
&tplParentRow=`@INLINE <li [[+classes]]>
<a class="dropdown-toggle" data-toggle="dropdown" href="[[+link]]" [[+attributes]]>
[[+menutitle]]<span class="caret"></span>
</a>