Skip to content

Instantly share code, notes, and snippets.

@monochromer
monochromer / self-invoke-constructor.js
Last active Aug 29, 2015
Конструкторы, вызывающие сами себя
View self-invoke-constructor.js
function myObject () {
if ( !(this instanceof myObject) ) {
return new myObject();
}
}
View all-checkboxes.js
angular.module("app", []).controller("ctrl", function($scope){
$scope.options = [
{value:'Option1', selected:true},
{value:'Option2', selected:false}
];
$scope.toggleAll = function() {
var toggleStatus = !$scope.isAllSelected;
angular.forEach($scope.options, function(itm){ itm.selected = toggleStatus; });
@monochromer
monochromer / animation-end-better.js
Last active Aug 29, 2015
Улучшение события окончания анимации
View animation-end-better.js
/*
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-';
@monochromer
monochromer / index.html
Last active Apr 26, 2016
Простой шаблон для html/css/js
View index.html
<!DOCTYPE html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--[if lt IE 8]><html class="no-js ie ltie8 ltie9 ltie10" lang="ru"><![endif]-->
<!--[if IE 8]><html class="no-js ie ie8 ltie9 ltie10" lang="ru"><![endif]-->
<!--[if IE 9]><html class="no-js ie gtie8 ie9 ltie10" lang="ru"><![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--><html class="no-js" lang="ru"><!--><![endif]-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
View zakas - js-app.js
// пример модуля
Core.register('module-name', function(sandbox) {
return {
init: function() {
// constrictor
if (sandbox.testSomething()) {
console.log('yes, you can!');
}
},
@monochromer
monochromer / .editorconfig
Last active Nov 9, 2015
Пример файла editorconfig
View .editorconfig
# http://editorconfig.org
# парсер не будет искать другие конфиги родительских папках
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 4
end_of_line = lf
View perfect-scrollbar.css
.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,
View .gitconfig
[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
@monochromer
monochromer / index.html
Created Jan 24, 2016
Простой пример observable
View index.html
<input type="text" id="a-text">
+
<input type="text" id="b-text">
=
<input type="text" id="c-text" readonly>
You can’t perform that action at this time.