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
/** | |
* An implementation for Quicksort. Doesn't | |
* perform as well as the native Array.sort | |
* and also runs the risk of a stack overflow | |
* | |
* Tests with: | |
* | |
* var array = []; | |
* for(var i = 0; i < 20; i++) { | |
* array.push(Math.round(Math.random() * 100)); |
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 objArr = WestUi.FriendsBar.friendsBarUi.friendsBar.getAllPlayers(), | |
friendsNames = objArr.map(function(item) { | |
return item.name; | |
}); | |
console.log(friendsNames); |
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 objArr = WestUi.FriendsBar.friendsBarUi.friendsBar.getAllPlayers(), | |
friendsNames = [], | |
i = 0; | |
for (i = 0; i < objArr.length; i++) | |
friendsNames[i] = objArr[i].name; | |
console.log(friendsNames); |
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
/* module update cloud commander */ | |
(function(){ | |
'use strict'; | |
if(!global.cloudcmd) | |
return console.log( | |
'# update.js' + '\n' + | |
'# -----------' + '\n' + | |
'# Module is part of Cloud Commander,' + '\n' + |
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 fs = require('fs'); | |
var buf = fs.readFileSync('les01.js');//process.argv[2] | |
var str = buf.toString(); | |
var arr = str.split("\n"); | |
console.log(arr.length - 1); |
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
body { | |
background-color: #000080; | |
color: #0FF; | |
} | |
a { | |
color: #0FF; | |
} | |
.cmd-button { |
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 Animal(name) { | |
this.name = name; | |
this.getName = function() { | |
console.log(this.name); | |
} | |
} | |
function Cat(name) { | |
this.name = name; | |
this.meow = 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 arr = [7,3,1,2,2,1,7,1,1,1,4], arrObj = {}; | |
function elementCount(arr) { | |
var i = 0, prop, name; | |
for (i = 0; i < arr.length; i++) { | |
name = arr[i]; | |
if (!arrObj[name]) { | |
arrObj[name] = 0; | |
} |
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 myFirstModule = require("./myFirstModule"); | |
myFirstModule.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
var i, j, | |
arr = [2,5,1,0], | |
max = 0, | |
n = arr.length; | |
for (i = 1; i < n; i++) | |
for (j = 0; j < n - 1 ; j++) { | |
max = arr[j + 1]; | |
if (arr[j] > max) { |