Skip to content

Instantly share code, notes, and snippets.

Vitaliy makshark

Block or report user

Report or block makshark

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View jqueryexample.js
$(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(){
View 13.js
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) {
View 12.js
// 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;
}
View index.js
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;
View SimplePalindrom.js
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++) {
View prime.js
<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
View qualfirst.js
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 {
View qual1.js
//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;
View 2-6
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]
You can’t perform that action at this time.