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 code = function(num1, num2) { | |
// Сложная логика с предсказуемым результатом: | |
return num1 + num2; | |
} | |
var test = function (func, args, result) { | |
var res = func.apply(this, args); | |
if (res != result) { | |
console.log('FAIL, expected: ' + result + ', recieved ' + res); | |
} else { |
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
// Если модели не равны — возвращается false | |
public static function isModelAndDataEquals(model:BaseModel, data:*):Boolean { | |
var res:Boolean, | |
i:int; | |
for (var prop:String in model) { | |
if (model.hasOwnProperty(prop)) { | |
if (data.hasOwnProperty(prop)) { | |
// Если модель | |
if (model[prop] is BaseModel) { | |
res = BaseModel.isModelAndDataEquals(model[prop], data[prop]); |
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
private function isProductSlotModelChangeKeyProperties(model:ProductionSlotModel):Boolean { | |
var index: int = getSlotViewIndexBySlotModel(_slots, model); | |
var slot:* = _slots[index]; | |
var result:Boolean = false; | |
if (model.locked){ | |
if (model.ready_for_open){ | |
result = slot is SerialProductionSlotViewLockedReady; | |
if (!result) return true; | |
} else { |
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
/** | |
* Created with JetBrains WebStorm. | |
* User: artem | |
* Date: 10.01.13 | |
* Time: 21:34 | |
* To change this template use File | Settings | File Templates. | |
*/ | |
var mysql = require('mysql'), | |
Promise = require("promise").Promise; |
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
<html><head><title>JBoss Web/7.0.13.Final - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 500 - </h1><HR size="1" noshade="noshade"><p><b>type</b> Exception report</p><p><b>message</b> <u></u></p><p><b>description</b> <u>The server encountered an internal error () that prevented it from fulfilling this request.</u></p><p><b>exception</b> <pre>javax.servlet.ServletException: Servlet.init() for servlet spring th |
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 db = []; | |
var maxCount = 573; | |
var neibourghsCount = 50; | |
for (var i = 0; i < maxCount; i++) { | |
db[i] = { | |
name: 'user' + i, | |
id: i, | |
exp: Math.round(Math.random() * 10000), | |
points: Math.round(Math.random() * 100000) |
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) { |
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
// 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 inst = { | |
name: 'custom name', | |
init: function () { | |
var _this = this; | |
$('body').on('click', function () { | |
_this.getName(); // переменная _this берется из замыкания | |
}); | |
}, | |
getName: function () { | |
console.log(this.name); |
OlderNewer