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
| const test = 0; | |
| let superLongValue = 'other value'; | |
| const someObject = {}; | |
| someObject.methodB = test >= superLongValue + 'text'; | |
| someObject.otherMethodC = test => superLongValue = test; |
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 inject = angular.mock.inject; | |
| var $q; | |
| describe('$q is really strange', function (){ | |
| beforeEach(inject(function ($injector){ | |
| $q = $injector.get('$q'); | |
| })); | |
| it('should proof that q is working properly', function (done){ | |
| var lastRequest = $q.defer(); |
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 toChain(target) { | |
| var queue = []; | |
| var lastReturn; | |
| Object.keys(target).forEach(function (prop) { | |
| var original; | |
| if (typeof target[prop] === 'function') { | |
| original = target[prop]; | |
| target[prop] = function () { | |
| var args = arguments; |
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.SomeIndexRoute = Ember.Route.extend({ | |
| model: function () { | |
| return this.store.find('some'); | |
| } | |
| }); | |
| App.SomeShowRoute = Ember.Route.extend({ | |
| model: function (params) { | |
| console.log('========================reload=========================='); // не вызывается если кликнуть по ссылке /#/some/111, но вызывается если обновить страницу | |
| var some = this.store.find('some', params.id); |
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 moduleFor(fullName, description, callbacks, delegate) { | |
| var container; | |
| var context; | |
| var _callbacks = { | |
| setup: function(){ | |
| callbacks = callbacks || { }; | |
| var needs = [fullName].concat(callbacks.needs || []); | |
| container = isolatedContainer(needs); |
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
| #include <Arduino.h> | |
| #include "Chassis.h" | |
| #define STOP 0 | |
| #define FORWARD 1 | |
| #define RIGHT 2 | |
| #define LEFT 4 | |
| #define BACKWARD 5 | |
| Chassis::Chassis(int D1, int P1, int D2, int P2) { |
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 inst = { | |
| name: 'custom name', | |
| init: function () { | |
| var _this = this; | |
| $('body').on('click', function () { | |
| _this.getName(); // переменная _this берется из замыкания | |
| }); | |
| }, | |
| getName: function () { | |
| console.log(this.name); |
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
| // Block | |
| BN | |
| .decl('main-page', 'mod', 'val') // mod and val are optional, but maybe we should prohibit modifications for javascript and use it only as CSS\DOM states | |
| .deps('page', 'content') // Maybe depricated | |
| .extends('page', 't-block') // Multiple inheritance: for data and view - complicate, for methods - override | |
| // Initial code, e.g. for pages router - runs after block been declarated. alt names - 'runs', 'runAfterDecl' | |
| .init(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 app = { | |
| name: 'Contact list', | |
| version: '0.1', | |
| db: 'mysql', | |
| transports: ['http', 'websocket'], | |
| auth: { | |
| controllers: 'Contact', | |
| types: { | |
| vk: { | |
| appCode: 1231341, |
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 Validator = (function (){ | |
| var rules = []; | |
| return { | |
| _add: function (rule) { | |
| if (rules[rule.objectName] === undefined) { | |
| rules[rule.objectName] = []; | |
| } | |
| rules[rule.objectName].push(rule); | |
| }, | |
| configurate: function (rules) { |