Skip to content

Instantly share code, notes, and snippets.

@ValentynaGorbachenko
ValentynaGorbachenko / CodingDojo-Challenges.js
Created October 4, 2016 20:46
CodingDojo-Challenges created by ValentynaGorbachenko - https://repl.it/C3o9/1
/*
Get 1 to 255
Write a function that returns an array with all the numbers from 1 to 255. You may use the push() function for this exercise.
*/
function get_array() {
var arr = [];
//your code here
for(var i=1; i<256; i++){
arr.push(i);
}
@ValentynaGorbachenko
ValentynaGorbachenko / RockPaperScissors.js
Created October 4, 2016 21:31
RockPaperScissors created by ValentynaGorbachenko - https://repl.it/DoVZ/0
var computerChoiceFunc = function(){
var compChoice = Math.random();
if (compChoice < 0.34) {
compChoice = "rock";
} else if(compChoice <= 0.67) {
compChoice = "paper";
} else {
compChoice = "scissors";
}
console.log("computer: "+ compChoice);
@ValentynaGorbachenko
ValentynaGorbachenko / index.css
Created October 4, 2016 21:32
TraficLight created by ValentynaGorbachenko - https://repl.it/DoVS/0
body {
font-family: sans-serif;
}
#controlPanel {
float: left;
padding-top: 30px;
}
.button {
@ValentynaGorbachenko
ValentynaGorbachenko / array_dups_sort.js
Created October 4, 2016 21:35
array_dups_sort created by ValentynaGorbachenko - https://repl.it/DoVE/1
/**
* Implement function with 1 argument typeof <Array>
* 1. function should delete all duplicating elements
* 2. function should remove all not Number values
* 3. function should sort array from the largest to the smallest number.
* For example: given array [1, 1, 3, 2, 'qwe', 6, true, 4, 2], result function should return [6, 4, 3, 2, 1]
*/
var arrayNotSorted = ['ggg', 'rtty', 1, 1, 1, 3, 2, 6, true, 4, 2];//I added few elements
var arraySorted; // If we like to save the incoming data
@ValentynaGorbachenko
ValentynaGorbachenko / objects_inheritance.js
Created October 4, 2016 21:39
objects_inheritance created by ValentynaGorbachenko - https://repl.it/CcaY/9
//Objects
var literalObject = {
name: "literalObject",
property1: "some data", //string
property2: 3, // number
property3: [], //array
property4: {},
method1: function(){
var result = [];
for (var prop in this) {
@ValentynaGorbachenko
ValentynaGorbachenko / index.css
Created October 4, 2016 21:40
Valentyna's_bakary created by ValentynaGorbachenko - https://repl.it/DoVC/0
body {
font-family: helvetica, sans-serif;
margin: 0 auto;
/*max-width: 600px;*/
background: #232323;
}
div {
height: 200px;
background-size: cover;
position: relative;
@ValentynaGorbachenko
ValentynaGorbachenko / index.css
Created October 4, 2016 21:58
Valentyna'sBlog created by ValentynaGorbachenko - https://repl.it/DoWX/0
header {
text-align: center;
background: url('http://gorbachenko.byethost18.com/assets/blog_bg2.png');
background-size: cover;
color: white;
}
a {
text-decoration: none;
color: white;
}
@ValentynaGorbachenko
ValentynaGorbachenko / index.css
Created October 4, 2016 22:03
personalWeb created by ValentynaGorbachenko - https://repl.it/DoW8/0
body {
text-align: center;
background: #5c5c5c url("http://gorbachenko.byethost18.com/assets/background_picture.png") ;
background-size: cover;
background-position: center top left;
color: white;
font-family: helvetica;
}
p {
font-size: 22px;
@ValentynaGorbachenko
ValentynaGorbachenko / SLL_Node.js
Created October 12, 2016 22:09
SLL_Node created by ValentynaGorbachenko - https://repl.it/Dq2c/31
function SLL(){
this.head = null;
}
function Node(val){
this.val = val;
this.next = null;
}
@ValentynaGorbachenko
ValentynaGorbachenko / binary_search.js
Created October 12, 2016 22:11
binary_search created by ValentynaGorbachenko - https://repl.it/C74Z/12
// O(log(n)) - time complexity
// O(n) - space complexity
function binarySearch(arr,val){
if (arr.length === 0){return -1;}
var li = 0;
var hi = arr.length-1;
while(li<=hi){
var mid = Math.floor(li+(hi-li)/2);