Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@monochromer
monochromer / jqueryui.datepicker.css
Last active August 29, 2015 14:20
Шаблон для jQuery UI Datepicker
/**
* календарь jQuery UI
*/
.ui-datepicker {
display: inline-block;
}
.ui-datepicker-header {
position: relative;
@monochromer
monochromer / jqueryui.slider.css
Last active August 29, 2015 14:20
Шаблон для jQuery UI Slider
/**
* Слайдер jQuery UI
*/
.ui-slider {
position: relative;
text-align: left;
}
/**
@monochromer
monochromer / set.js
Last active August 29, 2015 14:20
Реализация структуры "множество"
/**
* Создание множества.
* @constructor
*/
function Set() {
/**
* Приватная переменная для хранения множества
*/
var items = {};
@monochromer
monochromer / stack.js
Created April 30, 2015 08:56
Реализция структуры Стек
/**
* Стек.
* @constructor
*/
function Stack() {
/**
* Приватная переменная для хранения элементов стека
*/
var items = [];
@monochromer
monochromer / queue.js
Last active August 29, 2015 14:20
Реализация структуры "очередь"
/**
* Очередь
* @constructor
*/
function Queue () {
/**
* Приватная переменная для хранения элементов очереди
*/
var items = [];
@monochromer
monochromer / jquery.template.js
Last active August 29, 2015 14:20
заготовка для jquery-скрипта
(function(callback) {
callback(window.jQuery, window, document);
}(function($, window, document) {
// The $ is now locally scoped
$(function() {
});
}
}));
@monochromer
monochromer / namespace.js
Created May 15, 2015 04:44
Создание пространства имен в js
var APP = APP || {};
APP.namespace = function (ns_string) {
var parts = ns_string.split('.'),
parent = APP,
i, len;
if (parts[0] === "APP") {
parts = parts.slice(1);
}
@monochromer
monochromer / private-proto.js
Created May 15, 2015 05:58
Частные члены и прототипы
function Gadget () {
// частный член
var name ='iPod';
// общедоступная функция
this.getName = function () {
return name;
};
}
@monochromer
monochromer / self-invoke-constructor.js
Last active August 29, 2015 14:21
Конструкторы, вызывающие сами себя
function myObject () {
if ( !(this instanceof myObject) ) {
return new myObject();
}
}
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; });