This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function NativeTouchSlide(selector, minMoveX) { | |
| this.domSelector = document.querySelector(selector) || selector; | |
| this.sCh = this.domSelector.children; | |
| this.checkSelector = !!this.domSelector && this.sCh && this.sCh.length>1; | |
| this.minMoveX = minMoveX || 30; | |
| if (this.checkSelector) { | |
| this.domSelector.addEventListener('touchstart', this.onTouchStart.bind(this)); | |
| this.addClass(this.sCh[0], "current"); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function(){ | |
| var app = angular.module("kp", ['angularFileUpload', 'ngRoute', 'ngAnimate', 'ngSanitize']); | |
| app.config(['$routeProvider', '$locationProvider', function($routeProvider, $locationProvider){ | |
| $routeProvider | |
| .when("/", { | |
| templateUrl: "/offer/edit-template.html", | |
| controller: "KpController", | |
| controllerAs: "kp", | |
| resolve: { | |
| 'isAdmin': ['$http', '$q', function($http, $q) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var tabs = [{ | |
| "text": "Данные пользователя", | |
| "id": "user", | |
| "active": false, | |
| "hide": false | |
| }, | |
| { | |
| "text": "Информация о компании", | |
| "id": "company", | |
| "active": false, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;(function(){ | |
| var app = angular.module("app", ['ngRoute', 'ngAnimate', 'mwl.calendar']); | |
| app.config(['$routeProvider', '$locationProvider', function($routeProvider, $locationProvider){ | |
| $routeProvider | |
| .when("/", { templateUrl: "index.html", controller: "IndexCtrl" }) | |
| .when("/statuses", { templateUrl: "main.html", controller: "MainCtrl" }) | |
| .when("/tasks", { templateUrl: "tasks.html", controller: "TasksCtrl" }) | |
| .when("/task/:id", { templateUrl: "task.html", controller: "TasksCtrl" }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var events = require('events'), | |
| net = require('net'), | |
| channel = new events.EventEmitter(); | |
| channel.clients = {}; | |
| channel.subscriptions = {}; | |
| // Add listener on join event | |
| // we save client user object and send | |
| channel.on('join', function(id, client) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #logger.js | |
| module.exports = function(request, response, next) | |
| { | |
| var start = +new Date(), | |
| stream = process.stdout, | |
| url = request.url, | |
| method = request.method; | |
| response.on("finish", function(){ | |
| var duration = +new Date() - start, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| app.config(function($provide){ | |
| $provide.decorator("$exceptionHandler", ["$delegate", function($delegate){ | |
| return function(exception, cause) | |
| { | |
| exception.message = "Some exception message"; | |
| $delegate(exception, cause); //call out basic implementation | |
| alert(exception.message); //our custom alert | |
| } | |
| }]); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //#1 | |
| var attitude = function(original, replacement, source) | |
| { | |
| return function (source) | |
| { | |
| return source.replace(original, replacement); | |
| } | |
| } | |
| var slimify = attitude(/big test mark/ig, "smallone"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function throttle(method, context) | |
| { | |
| clearTimeout(method.tId); | |
| method.tId = setTimeout(function(){ | |
| method.call(context); | |
| }, 100); | |
| } | |
| //usage example | |
| window.onresize = function() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var map = $("#map_wrapper"), editorParams = { | |
| wayPointFinishDraggable: false, | |
| addWayPoints: false, | |
| editorDrawOver: false, | |
| wayPointFinishIconLayout: "default#image", | |
| wayPointFinishIconImageHref: '/new/include/img/footer-map-point.png', | |
| wayPointFinishIconImageSize: [171, 48], | |
| wayPointFinishIconImageOffset: [-55, -48], | |
| }; |