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
$(document).ready(function () { | |
$("#projectButton").click(function () { | |
$('#listOfNames').empty(); | |
$.post("/get_last_ten_projects_names", function (data) { | |
$.each(data['projects'], function (index, value) { | |
$('#listOfNames').append('<li>' + value + '</li>'); | |
}); | |
}); | |
}); | |
$("select#myAwesomeSelect").change(function(){ |
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 calc(n1, op, n2, n3) { | |
switch (op) { | |
case '+': | |
return ((n1 + n2) === n3); | |
case '-': | |
return ((n1 - n2) === n3); | |
case '*': | |
return ((n1 * n2) === n3); | |
case '/': | |
if (n2 === 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
// 1.2 Makovskyi | |
function search(needle, haystack) { | |
var i = 0; | |
var valueSearching = false; | |
if (typeof haystack === 'object') { | |
if (Array.isArray(haystack)) { | |
for (; i < haystack.length; i++) { | |
if (search(needle, haystack[i])) { | |
return true; | |
} |
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 highOrder(n) { | |
return (Math.pow(10, n) - 1); | |
} | |
function lowOrder(n) { | |
return (1 + Math.pow(10, n - 1)); | |
} | |
function isPrimary(i) { | |
var j = 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 mostSignificantDigit (n) { | |
var maxNumber = Math.pow(10, n) - 1; | |
return maxNumber; | |
} | |
function _minNumber (n) { | |
var minNumber = 1 + Math.pow(10, n - 1); | |
return minNumber; | |
} | |
function isPrimary (i) { | |
for ( var j = 2; j < Math.sqrt(i); j++) { |
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
<script> | |
//Compare incomming array with number | |
//Return true if combination is available for simple number | |
function compareValues(arr, number) { | |
var digits = ("" + number).split("").sort(); | |
arr = arr.map(String).sort(); | |
if (arr.length == digits.length) { | |
for (var z = 0; z < digits.length; z++) { | |
if (digits[z] != arr[z]) { | |
//Not equal |
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 deepSearch(arr, element) { | |
if (typeof arr != 'number') { | |
for (var i = 0; i < arr.length; i++) { | |
result = deepSearch(arr[i], element); | |
if (result) { | |
return true; | |
} | |
} | |
return false; | |
} else { |
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
//Compare incomming array with number | |
//Return true if combination is available for simple number | |
function compareValues(arr, number) { | |
var digits = ("" + number).split("").sort(); | |
arr = arr.map(String).sort(); | |
if (arr.length == digits.length) { | |
for (var z = 0; z < digits.length; z++) { | |
if (digits[z] != arr[z]) { | |
//Not equal | |
return false; |
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
m = [-1, 3, 64, 3, 2, -3, 42, -78, -19, 30, 23, 11, 21, -90, 1, -1, 7] | |
a = [] | |
b = [] | |
count = 1 | |
while count < m.length do | |
if m[count] % 2 == 0 | |
puts m[count] |
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
puts "Hello, World" |
NewerOlder