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
# General configuration for the init.d scripts, | |
# not necessarily for JBoss AS itself. | |
# default location: /etc/default/keycloak | |
## Location of JDK | |
# JAVA_HOME="/usr/lib/jvm/default-java" | |
## Location of WildFly | |
# JBOSS_HOME="/opt/keycloak" |
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 isEven(n) { | |
if (n == 0) | |
return true; | |
else if (n == 1) | |
return false; | |
else if (n < 0) | |
return isEven(-n); | |
else | |
return isEven(n-2); | |
} |
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 reverseStringBuiltIn(str) { | |
return str.split("").reverse().join(""); | |
} | |
console.log(reverseStringBuiltIn("himeinnameistundichbin")); | |
function reverStringForLoop(stri) { | |
var newString = ""; | |
for (i = stri.length-1; i>=0; i--) { | |
newString += stri[i]; |
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 solution(myArr) { | |
var myArr = [9, 3, 9, 3, 9, 7, 9, 4, 5, 6, 8, 3, 4, 1, 2, 5, 6, 7, 7, 4, 2]; | |
var sortedArray = myArr.slice().sort(); | |
var pairedArray = []; | |
var leftUnpaired = []; | |
console.log(sortedArray); | |
var i; | |
for (i = 0; i < sortedArray.length - 1; i++) { | |
if (sortedArray[i + 1] == sortedArray[i] || sortedArray[i - 1] == sortedArray[i]) { |
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 solution(myArr) { | |
var myArr = [9, 3, 9, 3, 9, 7, 9]; | |
var leng = myArr.length; | |
var result = []; | |
var leftObj = {}; | |
var i; | |
for (i = 0; i < leng; i++) { | |
leftObj[myArr[i]] = 0; | |
} |
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
// looping variant | |
var power = function(base, exponent) { | |
var result = 1; | |
for (var count = 0; count < exponent; count++) | |
result *= base; | |
return result; | |
}; | |
console.log(power(2, 10)); | |
// recursive way (MUCH MUCH slower) |
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 fac(n) { | |
if (n == 0) | |
return 1; | |
else | |
return fac(n - 1) * n; | |
} | |
fac(10); |
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
// UPSIDE DOWN TRIANGLE | |
function asterisk(n) { | |
for (i = n - 1; i >= 0; i--) { | |
for (j = 0; j < n - i; j++) { | |
document.write("..."); | |
} | |
for (k = 0; k < i * 2 + 1; k++) { | |
document.write(" * "); |
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
// NORMAL TRIANGLE left side | |
function triangle(n) { | |
for (i = 0; i < n; i++) { | |
for (j = 0; j < i + 1; j++) { | |
document.write(" * "); | |
} | |
document.write("</br>"); | |
} |
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
// first approach | |
function fibonacci(n) { | |
a = 0; | |
b = 1; | |
while (a <= n) { | |
console.log(a); | |
c = a + b; | |
a = b; | |
b = c; | |
} |
NewerOlder