Skip to content

Instantly share code, notes, and snippets.

@monochromer
monochromer / animation-end-better.js
Last active August 29, 2015 14:23
Улучшение события окончания анимации
/*
By Osvaldas Valutis, www.osvaldas.info
Available for use under the MIT License
*/
;( function ( document, window, index ) {
var s = document.body || document.documentElement, s = s.style, prefixAnimation = '', prefixTransition = '';
if( s.WebkitAnimation == '' ) prefixAnimation = '-webkit-';
if( s.MozAnimation == '' ) prefixAnimation = '-moz-';
// пример модуля
Core.register('module-name', function(sandbox) {
return {
init: function() {
// constrictor
if (sandbox.testSomething()) {
console.log('yes, you can!');
}
},
@monochromer
monochromer / .editorconfig
Last active November 9, 2015 08:26
Пример файла editorconfig
# http://editorconfig.org
# парсер не будет искать другие конфиги родительских папках
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 4
end_of_line = lf
[user]
name = user
email = user@example.com
[http]
proxy = http://127.0.0.1:8080
[https]
proxy = https://127.0.0.1:8080
[filter "hawser"]
clean = git hawser clean %f
smudge = git hawser smudge %f
.ps-container {
position: relative;
-ms-touch-action: none;
overflow: hidden !important;
}
.ps-container.ps-in-scrolling {
pointer-events: none;
}
.ps-container.ps-active-x > .ps-scrollbar-x-rail,
@monochromer
monochromer / index.html
Created January 24, 2016 15:56
Простой пример observable
<input type="text" id="a-text">
+
<input type="text" id="b-text">
=
<input type="text" id="c-text" readonly>
@monochromer
monochromer / Observer.js
Last active February 11, 2016 16:46
Шаблон "Наблюдатель (Подписчик-Издатель)"
var Observer = (function () {
'use strict';
var exports = {};
var events = {},
splitter = /\s+/;
var on = function(types, fn, context) {
var type;
@monochromer
monochromer / sync-gh-pages.sh
Last active March 8, 2016 08:38
Работа с веткой gh-pages
/* Синхронизация */
git checkout gh-pages
git rebase master
git push origin gh-pages
git checkout master
/* Deploy из папки dist */
git subtree push --prefix dist origin gh-pages
@monochromer
monochromer / package.json
Created March 8, 2016 11:44
npm-tasks-boilerplate
{
"name": "npm-tasks-boilerplate",
"version": "0.0.1",
"description": "",
"author": "Monochromer <monochromer@mail.ru>",
"scripts": {
"clean": "rm -rf build/",
"server": "browser-sync start --server \"build\" --files 'build/**/*.*' --directory",
"stylus": "stylus src/styles/main.styl -o build/css --include-css",
"prefix": "postcss -u autoprefixer --autoprefixer.browsers \"> 1%\" -r build/css/*",
@monochromer
monochromer / closest-polyfill.js
Created April 20, 2016 18:03
closest polyfill
;(function(Element) {
// matches polyfill
if (!Element.prototype.matches) {
Element.prototype.matches = Element.prototype.matchesSelector ||
Element.prototype.webkitMatchesSelector ||
Element.prototype.mozMatchesSelector ||
Element.prototype.msMatchesSelector ||
function matches(selector) {