Last active
August 29, 2015 14:09
-
-
Save Olegas/4eb23b3bad0658ebde0d to your computer and use it in GitHub Desktop.
How code style affects code review
This file contains 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
{ | |
/** | |
* Получить контрол по идентификатору. | |
* @param {String} id Идентификатор искомого контрола. | |
* @return {$ws.proto.Control} Найденный контрол. | |
* @deprecated Используйте $ws.proto.AreaAbstract.getChildControlByName | |
*/ | |
get : function(id){ | |
if (this._storage[id] === undefined) | |
throw new Error("ControlStorage : id = '" + id + "' not stored"); | |
return this._storage[id]; | |
} | |
} |
This file contains 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
this.doWork({ amount: 5, unit: "hour" }) |
This file contains 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 bubbleSort(r){var o;do{o=!1;for(var a=0;a<r.length-1;a++)if(r[a]>r[a+1]){var b=r[a];r[a]=r[a+1],r[a+1]=b,o=!0}}while(o)} |
This file contains 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 bubbleSort(array, direction) { | |
// ... | |
} | |
function quickSort(direction, array) { | |
// ... | |
} | |
function mergeSort(compareFunc, array) { | |
// ... | |
} |
This file contains 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
this.doWork({ | |
amount: 5, | |
unit: "hour" | |
}) |
This file contains 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 replaceTokens(str) { | |
if (typeof str !== 'string') { | |
// try to fix or throw error | |
} | |
return str.replace(/(some|token|regexp)/g, 'tok-$1'); | |
} |
This file contains 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 srt(x) | |
{ | |
var a; | |
do { | |
a = false; | |
for (var b=0; b < x.length-1; b++) { | |
if (x[b] > x[b+1]) { | |
var c = x[b]; | |
x[i] = x[b+1]; | |
x[b+1] = c; | |
a = true; | |
} | |
} | |
} while (a); | |
} |
This file contains 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
/** | |
* Сортировка пузырьком | |
* Изменяет переданный массив | |
* | |
* @param {Array} array массив для сортировки | |
*/ | |
function bubbleSort(array) | |
{ | |
var swapped; | |
do { | |
swapped = false; | |
for (var i=0; i < array.length-1; i++) { | |
if (array[i] > array[i+1]) { | |
var temp = array[i]; | |
array[i] = array[i+1]; | |
array[i+1] = temp; | |
swapped = true; | |
} | |
} | |
} while (swapped); | |
} |
This file contains 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
if (!(ctxVal === null && !self.isAllowEmpty()) && | |
(ctxVal !== self._notFormatedVal() || | |
self._valueSet === false && | |
ctxVal !== self._desiredDefaultValue)) { | |
// do something | |
} else { | |
// WAT????? | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment