Niklaus Wirth

Niklaus Wirth

Translate

Personal Portfolio Webpage

CodePen


HTML



<body>
  <div class="container">
  <div id="myHead">
  <div id="#menu">
<div class="text-center">          
<ul class="list-inline myMenu">
            <<li><a href="#myHead">Home</a></li>
              <li><a href="#aboutMe">About me</a></li>
              <li><a href="#myPort">Portfolio</a></li>
              <li><a href="#myCont">Contacts</a></li>
              </ul>
</div>
</div>
    <h1 class="text-center">Yaroslav Kolesnikov<h1>
      <h3 class="text-center">Welcome to my page</h3>
<hr>
      
      <div class="list-inline myButton text-center">
        <a href="https://twitter.com/JroslavK" target="_blank" title="Twitter">
<button class="btn btn-default">
<i class="fa fa-twitter" aria-hidden="true"></i> Twitter</button></a>
     <a href="https://github.com/YaroslavW" target="_blank" title="gitHub"> 
<button class="btn btn-default">
<i class="fa fa-github" aria-hidden="true"></i> GitHub</button></a>
        <a href="https://www.facebook.com/profile.php?id=100011231734286" target="_blank" title="Facebook">
      <button class="btn btn-default">
<i class="fa fa-facebook" aria-hidden="true"></i> Facebook</button></a>
      <a href="https://www.freecodecamp.com/yaroslavw" target="_blank" title="freeCodeCamp">
<button  class="btn btn-default" >
<i class="fa fa-free-code-camp" aria-hidden="true"></i> FreeCodeCamp</button></a>
 </div>     
    </div>
      </div>
      <div class="container">
    <div id="aboutMe">
      <div class="row">
      <div class="col-xs-12 col-sm-6 col-md-6 myText">Hey . I'm Yaroslav and now I'm going through a course in Front End Developer FreeCodeCamp. I love learning new stuff related to programming and technology. My passion is to use technology based solutions, to help solve real world challenges.<br />I have a higher medical education. I love to read and travel. When I do not do the encoding, I do self-education. You can find me on FreeCodeCamp, Codecademy and Udemy <br />My dream - to live and work in a free country, where appreciate the professionalism and human rights.</div>
       
        <div class="col-xs-12 col-sm-6 col-md-6 text-center">
<img src="https://pbs.twimg.com/profile_images/484989907845120000/fTyh8IC7_400x400.jpeg" class="img-rounded"/>
</div>
         <div class="clearfix visible-md"></div>
         </div>
       </div>
      </div>
      <div class="container">
    <div id="myPort">
      <div class="row">
        <div class="col-sm-6 col-md-3">
<div class="thumbnail">
<p data-height="265" data-theme-id="0" data-slug-hash="ygxwXP" data-default-tab="js,result" data-user="YaroslavW" data-embed-version="2" data-pen-title="Simon Game" class="codepen">See the Pen <a href="http://codepen.io/YaroslavW/pen/ygxwXP/">Simon Game</a>
 by YaroslavW (<a href="http://codepen.io/YaroslavW">@YaroslavW</a>) on <a href="http://codepen.io">CodePen</a>.</p>
<script async src="https://production-assets.codepen.io/assets/embed/ei.js"></script>

<div class="caption text-center"><a href="http://codepen.io/YaroslavW/pen/ygxwXP/" target="_blank">Simon Game</a> </div></a></div></div>

        <div class="col-sm-6 col-md-3">
<div class="thumbnail">
<p data-height="265" data-theme-id="0" data-slug-hash="dNjvgd" data-default-tab="js,result" data-user="YaroslavW" data-embed-version="2" data-pen-title="Pomodoro Clock" class="codepen">See the Pen <a href="http://codepen.io/YaroslavW/pen/dNjvgd/">Pomodoro Clock</a> by YaroslavW (<a href="http://codepen.io/YaroslavW">@YaroslavW</a>) on <a href="http://codepen.io">CodePen</a>.</p>
<script async src="https://production-assets.codepen.io/assets/embed/ei.js"></script><div class="caption text-center">
<a href="http://codepen.io/YaroslavW/pen/dNjvgd/" taarget="_blank">Pomodoro Clock</a></div></div></div>

        <div class="col-sm-6 col-md-3"><div class="thumbnail"><p data-height="265" data-theme-id="0" data-slug-hash="dNqGaZ" data-default-tab="js,result" data-user="YaroslavW" data-embed-version="2" data-pen-title=" Tic Tac Toe Game" class="codepen">See the Pen <a href="http://codepen.io/YaroslavW/pen/dNqGaZ/"> Tic Tac Toe Game</a> by YaroslavW (<a href="http://codepen.io/YaroslavW">@YaroslavW</a>) on <a href="http://codepen.io">CodePen</a>.</p>
<script async src="https://production-assets.codepen.io/assets/embed/ei.js"></script><div class="caption text-center"><a href="http://codepen.io/YaroslavW/pen/dNqGaZ/" target="_blank"> Tic Tac Toe Game</a></div></div></div>
         <div class="col-sm-6 col-md-3"><div class="thumbnail"><p data-height="265" data-theme-id="0" data-slug-hash="LxrVja" data-default-tab="js,result" data-user="YaroslavW" data-embed-version="2" data-pen-title="Build a Wikipedia Viewer" class="codepen">See the Pen <a href="http://codepen.io/YaroslavW/pen/LxrVja/">Build a Wikipedia Viewer</a> by YaroslavW (<a href="http://codepen.io/YaroslavW">@YaroslavW</a>) on <a href="http://codepen.io">CodePen</a>.</p>
<script async src="https://production-assets.codepen.io/assets/embed/ei.js"></script><div class="caption text-center"><a href="http://codepen.io/YaroslavW/pen/LxrVja/" target="_blank">Wikipedia Viewer</a></div></div></div>
      </div>
      <div class="row">
        <div class="col-sm-6 col-md-3"><div class="thumbnail"><p data-height="265" data-theme-id="0" data-slug-hash="WRyVQL" data-default-tab="js,result" data-user="YaroslavW" data-embed-version="2" data-pen-title="JavaScript Calculator" class="codepen">See the Pen <a href="http://codepen.io/YaroslavW/pen/WRyVQL/">JavaScript Calculator</a> by YaroslavW (<a href="http://codepen.io/YaroslavW">@YaroslavW</a>) on <a href="http://codepen.io">CodePen</a>.</p>
<script async src="https://production-assets.codepen.io/assets/embed/ei.js"></script><div class="caption text-center"><a href="http://codepen.io/YaroslavW/pen/WRyVQL/" target="_blank">JavaScript Calculator</a></div></div></div>
        <div class="col-sm-6 col-md-3"><div class="thumbnail"><p data-height="265" data-theme-id="0" data-slug-hash="egKYRa" data-default-tab="js,result" data-user="YaroslavW" data-embed-version="2" data-pen-title="Show the Local Weather" class="codepen">See the Pen <a href="http://codepen.io/YaroslavW/pen/egKYRa/">Show the Local Weather</a> by YaroslavW (<a href="http://codepen.io/YaroslavW">@YaroslavW</a>) on <a href="http://codepen.io">CodePen</a>.</p>
<script async src="https://production-assets.codepen.io/assets/embed/ei.js"></script><div class="caption text-center"><a href="http://codepen.io/YaroslavW/pen/egKYRa/" target="_blank">Show the Local Weather</a></div></div></div>
        <div class="col-sm-6 col-md-3"><div class="thumbnail"><p data-height="265" data-theme-id="0" data-slug-hash="PWeMjV" data-default-tab="js,result" data-user="YaroslavW" data-embed-version="2" data-pen-title="Build a Random Quote Machine(2)  " class="codepen">See the Pen <a href="http://codepen.io/YaroslavW/pen/PWeMjV/">Build a Random Quote Machine(2)  </a> by YaroslavW (<a href="http://codepen.io/YaroslavW">@YaroslavW</a>) on <a href="http://codepen.io">CodePen</a>.</p>
<script async src="https://production-assets.codepen.io/assets/embed/ei.js"></script><div class="caption text-center"><a href="http://codepen.io/YaroslavW/pen/PWeMjV/" target="_blank">Random Quote Machine  </a></div></div></div>
         <div class="col-sm-6 col-md-3"><div class="thumbnail"><p data-height="265" data-theme-id="0" data-slug-hash="GrGpXy" data-default-tab="html,result" data-user="YaroslavW" data-embed-version="2" data-pen-title="Twitchtv JSON API" class="codepen">See the Pen <a href="http://codepen.io/YaroslavW/pen/GrGpXy/">Twitchtv JSON API</a> by YaroslavW (<a href="http://codepen.io/YaroslavW">@YaroslavW</a>) on <a href="http://codepen.io">CodePen</a>.</p>
<script async src="https://production-assets.codepen.io/assets/embed/ei.js"></script><div class="caption text-center"><a href="http://codepen.io/YaroslavW/pen/GrGpXy/" target="_blank">Twitchtv JSON API</a></div></div></div>
      </div>
      </div>
      </div>
    <div class="container">
    <div id="myCont">
      <div class="row">
        <div class="col-xs-8 col-sm-8 col-md-8 col-lg-8">
       <h3 class="text-center">You can write to me</h3>
          <h3 class="myEmail text-center">kolesnikovy70 @gmail.com</h3>
          <p class="myPhone text-center">8-(8888)-8-888-888-888.</p>
        </div>
      <div clas="row">
       <div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
          <a href="https://twitter.com/JroslavK" type="button" target="_blank" title="Twitter" class="btn btn-default target btn-block" target="_blank"><i class="fa fa-twitter" aria-hidden="true"></i> <span class="signa">Twitter</span></a>
          <div clas="row"> <a href="https://github.com/YaroslavW" type="button" target="_blank" title="GitHub" class="btn btn-default target btn-block" target="_blank"><i class="fa fa-github" aria-hidden="true"></i> <span class="signa">GitHub</span></a></div>
          <div clas="row"> <a href="https://www.facebook.com/profile.php?id=100011231734286" target="_blank" title="Facebook" type="button" class="btn btn-default target btn-block"><i class="fa fa-facebook" aria-hidden="true"></i> <span class="signa">Facebook</span></a></div>
          <div clas="row"><a href="https://www.freecodecamp.com/yaroslavw"target="_blank" title="freeCodeCamp" type="button" class="btn btn-default target btn-block"><i class="fa fa-free-code-camp" aria-hidden="true"></i> <span class="signa">FreecodeCamp</span></a></div>  
      </div> </div></div>
      <div class="col-xs-1 col-sm-1 col-md-1 col-lg-1"></div>
    </div>
    <div class="container">
      <div class="row">
        <div class="col-md-12">
      <div id="myFooter"><div class=" text-center">         
<ul class="list-inline myMenu">
            <li><a href="#myHead">Home</a></li>
              <li><a href="#aboutMe">About me</a></li>
              <li><a href="#myPort">Portfolio</a></li>
              <li><a href="#myCont">Contacts</a></li>
          </ul></div><hr>
        <div class="text-center">Built by Yaroslav Kolesnikov.</div>
        </div>
          </div>
      </div>
      </div>
</body>




@import url(https://fonts.googleapis.com/css?family=Lato);

#myHead{
  height:400px;
  background-image:URL('https://i.ytimg.com/vi/rSxufmWM6bo/maxresdefault.jpg');
}
.myButton {
  margin-top:5%;
}
.myMenu a{
  font-size:26px;
  color:white;
}
#myHead h1{
  color:red;
}
#myHead h3{
  color:#D8CDF1;
}
#aboutMe{
  background-color:#E9E6FF;
  height: 480px;
}
#aboutMe img{
  margin-top:50px;
  width:300px;
  height:300px;
  border-radius:4000px;
}
.myText{
  margin:0px;
  font-family:Lato;
  font-size: 1.8rem;
  padding-top:3%;
  padding-left:5%;
  
}
hr {
  border:none; 
  background:#D8CDF1;
  height:3px;
  width:50%;
} 
#myCont{
  height:auto;
  background-image:URL('http://www.newhdwallpapers.in/wp-content/uploads/2014/07/Computer-Networking-Cable-Hi-tech-Wallpaper.jpg');
}
#myCont h3{
  color:#D8CDF1;
  font-size:5rem;
  font-family:Impact;
}
#myCont .target{
  margin-top:50px;
  margin-bottom: 50px;
}
#myCont .myEmail{
  margin-top:10%;
  font-size:4rem;
  font-family:Lato;
  color: red;
}
.myPhone{
  font-size:300%;
  font-family:Momospace;
  color:#00AFB8;
  margin-top:5%;
}
#myPort{
  background-color:#E9E6FF;
}
#myFooter{
  margin-top:5%;
}
#myFooter li a{
 color: black;
}
@media screen and (max-width: 992px) { 
  span.signa {
    display: none;
  }
  #myCont .target{
  margin:10px;  
}
};







See the Pen LandingPage(for change) by YaroslavW (@YaroslavW) on CodePen.


Twitchtv JSON API

Codepen, Twitchtv JSON API

HTML



<link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet">
<div class="row">
<div class="col-md-6 col-md-offset-3">
<div class="animated bounceIn">
 <div class="header">
  <h1 class="title"> Twitch TV Streamers</h1>
  <nav class="navbar">
  <div class="container-fluid">
     <ul class="nav navbar-nav">
  <li><a class="navtext all" type="button">All</a></li>
  <li><a class="navtext online" type="button">Online</a></li>
  <li><a class="navtext offline" type="button">Offline</a></li>
  </ul>
  </div>
  </nav>
<div class="container-fluid">

 </div>
 <div class="streamers">
  
  <div class="streamerblock streamerblock0">
   <img src="https://x1.xingassets.com/assets/frontend_minified/img/users/nobody_m.original.jpg" class="profile0 profile img-circle">
   <a type="button" class="name0 name">Name</a>
   <p class="stream0 stream">Stream/Offline</p>
   <div class="line"></div>
  </div>
  
  <div class="streamerblock streamerblock1">
   <img src="https://x1.xingassets.com/assets/frontend_minified/img/users/nobody_m.original.jpg" class="profile profile1 img-circle">
   <a type="button" class="name name1">Name</a>
   <p class="stream stream1">Stream/Offline</p>
   <div class="line"></div>
  </div>
  
  <div class="streamerblock streamerblock2">
   <img src="https://x1.xingassets.com/assets/frontend_minified/img/users/nobody_m.original.jpg" class="profile profile2 img-circle">
   <a type="button" class="name name2">Name</a>
   <p class="stream stream2">Stream/Offline</p>
   <div class="line"></div>
  </div>
  
  <div class="streamerblock streamerblock3">
   <img src="https://x1.xingassets.com/assets/frontend_minified/img/users/nobody_m.original.jpg" class="profile profile3 img-circle">
   <a type="button" class="name name3">Name</a>
   <p class="stream stream3">Stream/Offline</p>
   <div class="line"></div>
  </div>
  
  <div class="streamerblock streamerblock4">
   <img src="https://x1.xingassets.com/assets/frontend_minified/img/users/nobody_m.original.jpg" class="profile profile4 img-circle">
   <a type="button" class="name name4">Name</a>
   <p class="stream stream4">Stream/Offline</p>
   <div class="line"></div>
  </div>
 
  <div class="streamerblock streamerblock5">
   <img src="https://x1.xingassets.com/assets/frontend_minified/img/users/nobody_m.original.jpg" class="profile profile5 img-circle">
   <a type="button" class="name name5">Name</a>
   <p class="stream stream5 ">Stream/Offline</p>
   <div class="line"></div>
  </div>
 
  <div class="streamerblock streamerblock6">
   <img src="https://x1.xingassets.com/assets/frontend_minified/img/users/nobody_m.original.jpg" class="profile profile6 img-circle">
   <a type="button" class="name name6"></a>
   <p class="stream stream6">Stream/Offline</p>
   <div class="line"></div>
  </div>
  
  <div class="streamerblock streamerblock7">
   <img src="https://x1.xingassets.com/assets/frontend_minified/img/users/nobody_m.original.jpg" class="profile profile7 img-circle">
   <a type="button" class="name name7">Name</a>
   <p class="stream stream7">Stream/Offline</p>
   <div class="line"></div>
  </div>
 </div>
 <footer>
  <div class="about">
   <p class="text-center abouttext">This is a project by Yaroslav Kolesnikov for <a type="button" class="fcc">Free Code Camp</a> 2016</p>
  </div>
 </footer>
</div>
</div>
</div>
</div>


CSS



body{
 background-color:#C6CAC1; 
}
.header{
 width:100%;
 background-color:#B2AAAA;
 text-align:center;
 border-radius:10px;
 margin:auto;
}
.title{
 padding-top:20px;
 font-family:Lato;
 color:#6441A5;
}
.myname{
 font-size:20px;
 color:#6441A5;
}
.navbar{
 margin:auto;
}
.streamers{
 width:100%;
 margin:auto;
 background:white;
 border-radius:10px;
 padding-bottom:20px;
  text-align: left;
}
nav{
 background-color:#6441A5;
 font-family:Lato;
}
.text{
 color:#6441A5;
 font-family:Lato;
}  
.abouttext{
  background-color:#B2AAAA;
  border-radius:10px;
 color:#6441A5;
 margin-top:20px;
}
.profile{
 border-radius:100%;
 width:70px;
 margin-top:2%;
 margin-bottom:2%;
 margin-left:2%;
}
.name{
 color:#6441A5;
 font-size:15px;
 display:inline-block;
}
.stream{
 color:#6441A5;
 font-size:15px;
 display:inline-block;
}
.line{
 width:100%;
 height:1px;
 background-color:#6441A5;
}

.navtext{
 font-size:1.5rem;
}



JS



var streamers =[ "freecodecamp","OgamingSC2", "RobotCaleb","brunofin12","noobs2ninjas","storbeck", "cretetion","habathcx","ESL_SC2"];
var offline;
var streamerurl;

$(document).ready(function(){
 function twitchstreamer(streamer,block){
  $.ajax({
   type: 'GET',
   url: 'https://api.twitch.tv/kraken/channels/' + streamer,
   headers: {
    'Client-ID': 'ttmj4g3n804793e2zkjpybb2grkgh3'
   },
   success: function(data) {
    console.log(data);
    
    $('.name' + block).html(data.display_name);

   
    var profilepic = data.logo;
    $('.profile' + block).attr("src", profilepic);

    $('.name' + block).click(function(){
     window.open('https://twitch.tv/'+streamer)
    })
   }
  })
 
  $.ajax({
   type: 'GET',
   url: 'https://api.twitch.tv/kraken/streams/' + streamer,
   headers: {
    'Client-ID': 'co9k9t8sd7pi3lq1p3jvc2oyaojbpf3'
   },
   success: function(idx) {
    console.log(idx);
    if(idx.stream === null){
     //Offline
     $('.stream' + block).html('Offline');
     $('.streamerblock' + block).addClass('channeloffline');
    }else{
    
     $('.stream' + block).html(idx.stream.channel.status);
     $('.streamerblock' + block).addClass('channelonline');
    }
   },
   error:function(err){
    //The channel does not exist
    console.log(err);
    $('.stream').html('This channel does not exist');
   }
  })
 }
 
 twitchstreamer(streamers[0],0);//1
 twitchstreamer(streamers[1],1);//2
 twitchstreamer(streamers[2],2);//3
 twitchstreamer(streamers[3],3);//4
 twitchstreamer(streamers[4],4);//5
 twitchstreamer(streamers[5],5);//6
 twitchstreamer(streamers[6],6);//7
 twitchstreamer(streamers[7],7);//8
 
 
 $('.all').click(function(){
  $('.channelonline').show();
  $('.channeloffline').show();
 })
 $('.online').click(function(){
  $('.channeloffline').hide();
  $('.channelonline').show();
 })
 $('.offline').click(function(){
  $('.channeloffline').show();
  $('.channelonline').hide();
 })
 
 $('.fcc').click(function(){
  openfcc();
 })
})

function openfcc(){
 window.open('https://freecodecamp.com');
}



See the Pen Twitchtv JSON API by YaroslavW (@YaroslavW) on CodePen.


Simon Game

#100DaysOfCode

CodePen



    <div class="control-wrapper">
        <button type="button" class="btn btn-primary" onClick="changeRegjme('Normal')">Normal regjme</button>
        <button type="button" class="btn btn-danger" onClick="changeRegjme('Hard')">Hard Regjme</button>
        <button type="button" class="btn btn-success" onClick="init()">Start New Game</button>
    </div>

    <div class="simon-wrapper">
        <div class="simon-info">
            <h2>Simon</h2>
            <span class="info">Count: </span><span id="count">0</span>
            <span class="info">Regjme: </span><span id="regjme">Normal</span>
            <span class="info" id="note">Click to play!</span>
        </div>
        <div id="btn0" class="btn-game top left green" onClick="clickBtn(0)"></div>
        <div id="btn1" class="btn-game top right red" onClick="clickBtn(1)"></div>
        <div id="btn2" class="btn-game bottom left yellow" onClick="clickBtn(2)"></div>
        <div id="btn3" class="btn-game bottom right blue" onClick="clickBtn(3)"></div>
    </div>




body {
    background-color: #EBEBEB;
}

.control-wrapper {
    margin: 0 auto;
    justify-content: center;
    text-align: center;
}

.simon-wrapper {
    background-color: #D6D6D6;
    border: 5px solid black;
    border-radius: 50%;
    height: 300px;
    margin: 0 auto;
    margin-top: 10%;
    overflow: hidden;
    position: relative;
    width: 300px;
}

.simon-info {
    background-color: #222;
    border-radius: 50%;
    color: white;
    height: 180px;
    margin-top: 53px;
    margin-left: 57px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 180px;
}
.simon-info h2 {
    font-size: 28px;
    font-weight: bold;
    margin-top: 20%;
    text-align: center;
    
}
.simon-info span {
    display: inline-block;
    font-weight: bold;
    text-align: center;
}
.simon-info span.info {
    margin-left: 30%;
}

.btn-game {
    float: left;
    height: 50%;
    overflow: hidden;
    width: 50%;
}
.btn-game.top {
    border-bottom: 3px solid black;
}
.btn-game.bottom {
    border-top: 3px solid black;
}

.btn-game.right {
    border-left: 3px solid black;
}

.btn-game.left {
    border-right: 3px solid black;
}

.btn-game.green {
    background-color: rgba(0, 213,29, 0.9);
}

.btn-game.red {
    background-color: rgba(213, 40, 17, 0.9);
}

.btn-game.yellow {
    background-color: rgba(255, 255, 0, 0.9);
}
.btn-game.blue {
    background-color: rgba(9, 74, 143, 0.9);
}

.btn-press {
    background-color: rgba(255,255,255,1) !important;
}




var playControl = {
    count: 0,
    regjme: "Normal",
    speed: 1200,
    wait: false

};

var model = [],
    currModel = [],
    userModel = [];

function init() {
    playControl.wait = false;
    model = [];
    userModel = [];
    playControl.count = 0;
    $('#count').text('0');
    $('#note').text("New game!");
    $('#regjme').text(playControl.regjme);

    createModel();
    showModel();
}


function color() {
    return Math.floor(Math.random() * (3 - 0 + 1) + 0);
}


function createModel() {
    model = [];
    for (var i = 20; i > 0; i--) {
        model.push(color());
    }
    return model;
}


function showModel() {
    var i = 0;
    playControl.wait = false;
    var modelLoop = setInterval(function () {
        fireBtn(model[i]);
        i++;
        if (i >= playControl.count + 1) {
            clearInterval(modelLoop);
            currModel = model.slice(0, playControl.count + 1);
            userModel = [];
            playControl.wait = true;
        }
    }, playControl.speed - playControl.count * 15);
}


function fireBtn(bNum) {
    var sound = new Audio('https://s3.amazonaws.com/freecodecamp/simonSound' + (bNum + 1) + '.mp3');
    $('#btn' + bNum).addClass('btn-press');

    setTimeout(function () {
        $('#btn' + bNum).removeClass('btn-press');
    }, 300);


    sound.play();
}


function changeRegjme(regjme) {
    playControl.regjme = regjme;
    $('#regjme').text(playControl.regjme);
}


function testModel() {
    for (var i = 0; i < userModel.length; i++) {
 
        if (userModel[i] != currModel[i]) {
            $('#note').text("Wrong!!");
            playControl.wait = false;
            if (playControl.regjme == "Normal") {
                return showModel();
            } else {
                init();
            }
        }
    }

    if (userModel.length === currModel.length) {
        $('#note').text("Correct!!");
        playControl.wait = false;
        userModel = [];
        playControl.count++;
        updateCount();
        return showModel();
    }
}


function updateCount() {
    $('#count').text(playControl.count);
}

function checkWin() {
    if (playControl.count >= 21) {
        $('#note').text("You won!! Prepare for the next round!");
        setInterval(function () {
            playControl.speed = 1000;
            init();
        }, 5000)
    }
}


function clickBtn(bNum) {
    if (playControl.wait === true) {
        fireBtn(bNum);
        userModel.push(bNum);
        testModel();
    }
}


See the Pen Simon Game by YaroslavW (@YaroslavW) on CodePen.


Tic Tac Toe Game

#100DayOfCode

codepen.io

HTML




<div class="sign-select">
 <h3>Choose your weapon:</h3>
 <button type="button" class="btn btn-default cell-X" onclick="signSelect('X', 'O')">X</button>
 <button type="button" class="btn btn-default cell-O" onclick="signSelect('O', 'X')">O</button>
</div>

<div id="game" class="game-wrapper">
 <div class="row row-top">
  <div id="cell0" class="cell" data-position=0></div>
  <div id="cell1" class="cell" data-position=1></div>
  <div id="cell2" class="cell" data-position=2></div>
 </div>
 <div class="row row-mid">
  <div id="cell3" class="cell" data-position=3></div>
  <div id="cell4" class="cell" data-position=4></div>
  <div id="cell5" class="cell" data-position=5></div>
 </div>
 <div class="row row-bot">
  <div id="cell6" class="cell" data-position=6></div>
  <div id="cell7" class="cell" data-position=7></div>
  <div id="cell8" class="cell" data-position=8></div>
 </div>
</div>



CSS



body {
 background: #F2F2F2;
}

.cell {
 float: left;
 background: #F2F2F2;
 width: 100px;
 height: 100px;
 border: 2px solid #0496ff;
 font-size: 52px;
 font-weight: bold;
 color: #fbfcff;
 justify-content: center; 
  text-align: center;
 padding-top: 15px;
}

.row-top .cell {
 border-top: none;
}

.row-cell {
 
}

.row-bot .cell {
 border-bottom: none;
}

#cell0, #cell3, #cell6 {
 border-left: none;
}

#cell2, #cell5, #cell8 {
 border-right: none;
}

.game-wrapper {
 margin: 15px auto;
 justify-content: space-around;
  text-align: center;
 width: 350px;
}

.sign-select {
 margin: auto;
 display: none;
 justify-content: center;
 padding-left: 45px;
  text-align: ;
 height: 200px;
 width: 325px;
  background: #F2F2F2;
}

.sign-select h3 {
 padding-top: 10%;
}

.sign-select .btn {
 height: 80px;
 width: 80px;
 font-size: 42px;
 font-weight: bold;
}

.cell-X {
 color: #00E700;
}

.cell-O {
 color: #fe4a49;
}



JS




var playField = ["", "", "",
    "", "", "",
    "", "", ""];

var gamer = {
 sign: '',
 wins: 0,
};

var comp = {
 sign: '',
 wins: 0,
};


var control = {
 roll: '',
 stop: false,
};


function Think() {
 if (control.roll === 'comp' && Win(gamer.sign) === false) {
  var emptSp = Empty();
  var movSp = Math.floor(Math.random() * (emptSp.length-1 - 0 + 1)) + 0;
  if (addSymb(comp.sign, emptSp[movSp]) === 'moved') {
   control.roll = 'gamer';
  }
   Win(comp.sign);
 }
}

function Empty() {
 var emptSp = [];
 for (var i=0; i< playField.length; i++) {
  if (playField[i] === "") {
   emptSp.push(i);
  }
 }
 return emptSp;
}



function Win(sign) {
 Horz(sign);
 Vert(sign);
 Diag(sign);
 Draw();
 
 if (control.stop === true) {
  init();
  return true;
 } else {
  return false;
 }
 
}

function Horz(sign) {
 if (playField[0] === sign &&
   playField[1] === sign &&
    playField[2] === sign) {
  control.stop = true;
 } else if(playField[3] === sign &&
      playField[4] === sign &&
      playField[5] === sign) {
  control.stop = true;
 } else if(playField[6] === sign &&
      playField[7] === sign &&
         playField[8] === sign) {
  control.stop = true;
 }
}

function Vert(sign) {
 if (playField[0] === sign &&
   playField[3] === sign &&
    playField[6] === sign) {
  control.stop = true;
 } else if(playField[1] === sign &&
      playField[4] === sign &&
      playField[7] === sign) {
  control.stop = true;
 } else if(playField[2] === sign &&
      playField[5] === sign &&
      playField[8] === sign) {
  control.stop = true;
 }
}

function Diag(sign) {
 if (playField[0] === sign &&
   playField[4] === sign &&
    playField[8] === sign) {
  control.stop = true;
 } else if(playField[2] === sign &&
      playField[4] === sign &&
      playField[6] === sign) {
  control.stop = true;
 }
}

function Draw() {
 if (Empty().length === 0) {
  control.stop = true;
 }
}


function clearField() {
 for (var i=0; i < playField.length; i++) {
   playField[i] = "";
   $('#cell' + i).text("");
   $('#cell' + i).removeClass('cell-X');
   $('#cell' + i).removeClass('cell-O');
 }
}


function init() {
 clearField()
 gamer.sign = '';
 comp.sign = '';
 control.roll = '';
 control.stop = false;
 $('.sign-select').show();
}

function signSelect(pSymbol, cSymbol) {
 gamer.sign = pSymbol;
 comp.sign = cSymbol;
 $('.sign-select').hide();
 
 if (gamer.sign === 'O') {
  control.roll = 'comp';
  setTimeout(function(){Think()}, 500);
 } else {
  control.roll = 'gamer';
 }
 
}


function addSymb(sign, pos) {
 if (playField[pos] === '') {
  playField[pos] = sign;
  $('#cell' + pos).addClass('cell-' + sign);
  $('#cell' + pos).text(sign);
  Win(sign);
  return 'moved';
 }
}

$('.cell').click(function(){
 if (control.roll === 'gamer') {
  var pos = this.getAttribute("data-position");
  if (addSymb(gamer.sign, pos) === 'moved') {
   control.roll = 'comp';
   setTimeout(function(){Think()}, 500);
  }
 }
 
 Win(gamer.sign);
 Win(comp.sign);
 
});

init();


See the Pen Tic Tac Toe Game by YaroslavW (@YaroslavW) on CodePen.


Pomodoro Clock

Pomodoro Clock

HTML



<audio id="bell" src="http://www.mediacollege.com/downloads/sound-effects/money/cash-register-01.wav" type="audio/mpeg"></audio>
    <div class="container-fluid text-center">
        <h1>Pomodoro Clock</h1>
        <h3>An App To Manage Your Time</h3>
        <div class="sesTimer">
            <h1 id="timeSes">Session Time</h1>
            <h1 id="timeType"></h1>
            <a href="#" class="btn btn-primary" id="minTime">-</a>
            <h2 id="num">25</h2>
            <a href="#" class="btn btn-primary" id="adTime">+</a>
            <a href="#" class="btn btn-primary" id="reset">Reset</a>
        </div>
        <div id="brTimer">
            <h1 id="timerBr">Break Time</h1>
            <a href="#" class="btn btn-primary" id="minBr">-</a>
            <h2 id="numBr">5</h2>
            <a href="#" class="btn btn-primary" id="adBr">+</a>
        </div>
        <a href="#" class="btn btn-primary" id="start">Start</a>
    </div>


CSS



@import url(https://fonts.googleapis.com/css?family=Lato);
body{
 background-image:url("http://reallondon.ru/wp-content/uploads/2013/03/18-e1386001921165.jpg");
 font-family: "Lato";
    background-size:100%;
    background-origin:padding-box;
    background-size:cover;    
    background-attachment: fixed;
    color: black;
}
h1{
 color: black;   
}
h2{
    display: inline;
}

#start {
 margin: 10px;
}
#num,
#numBr{
  color:red;
  font-weight: bold;
}


JS



$(document).ready(function() {

    $("#message").hide();
    var buzzer = $("#bell")[0];
    var count = parseInt($("#num").html());
    var breakTime = parseInt($("#numBr").html());

    $("#reset").hide();

    $("#start").click(function() {
        var counter = setInterval(timer, 1000);
        count *= 60;

        function timer() {
            
            $("#start, #minTime, #adTime,#minBr,#adBr,#numBr,#timeSes,#timeBr").hide();
            $("#timeType").show();
            $("#timeType").html("Session Time: ");

            var display = $('#num');
            timeset(count, display);
            count -= 1;
            if (count === 0) {
                buzzer.play();
                clearInterval(counter);
                var startBreak = setInterval(breakTimer, 1000);
                breakTime *= 60;
                $("#num").hide();
                breakTimer();
            }

            function breakTimer() {
                $("#numBr").show();
                $("#timeType").html("Break Time: ");

                var bdisplay = $('#numBr');
                timeset(breakTime, bdisplay);
                breakTime -= 1;
                if (breakTime === 0) {
                    clearInterval(startBreak);
                    buzzer.play();
                    $("#timeType").hide();
                    $("#reset").show();
                    $("#numBr").hide();
                }
            }
        }
    });

    function timeset(clock, display) {
        var hours, minutes, seconds;
        hours = parseInt(Math.floor(clock / 3600, 10));
        minutes = parseInt(Math.floor(clock % 3600 / 60));
        seconds = parseInt(Math.floor(clock % 3600 % 60));

        hours = hours > 0 ? "0" + hours : hours;
        minutes = minutes < 10 ? "0" + minutes : minutes;
        seconds = seconds < 10 ? "0" + seconds : seconds;
        var out = display.text(hours + ":" + minutes + ":" + seconds);
        return out;
    }

    $("#reset").click(function() {
        count = 25;
        breakTime = 5;
        $("#num").html(count);
        $("#numBr").html(breakTime);
        $("#start, #minTime, #num, #adTime,#minBr,#adBr,#numBr,#timeSes,#timeBr").show();
        $("#reset").hide();
    });

    $("#minTime").click(function() {
        if (count > 1) {
            count -= 1;
            $("#num").html(count);
        }
    });

    $("#adTime").click(function() {
        count += 1;
        $("#num").html(count);

    });
    $("#minBr").click(function() {
        if (breakTime > 1) {
            breakTime -= 1;
            $("#numBr").html(breakTime);
        }
    });

    $("#adBr").click(function() {
        breakTime += 1;
        $("#numBr").html(breakTime);

    });
});


See the Pen Pomodoro Clock by YaroslavW (@YaroslavW) on CodePen.


JavaScript Calculator

JavaScript Calculator

CodePen"



<div id="calculator">
  
  <div id="screen"> 0 </div>
  
  <div>
    <button id="ac">AC</button>
    <button id="del">←</button>
    <button class="op">%</button>
    <button class="op">/</button>
  </div>
  
  <div>
    <button class="num">7</button>
    <button class="num">8</button>
    <button class="num">9</button>
    <button class="op">x</button>
  </div>
  
  <div>
    <button class="num">4</button>
    <button class="num">5</button>
    <button class="num">6</button>
    <button class="op">-</button>
  </div>
  
  <div>
    <button class="num">1</button>
    <button class="num">2</button>
    <button class="num">3</button>
    <button class="op">+</button>
  </div>
  
  <div>
    <button class="num" id="0">0</button>
    <button class="num" id=".">.</button>
    <button id="equal">=</button>
  </div>
  
</div>




body {
  background-color: #EBEBEB;
  text-align: center;
  color: white;
}

#calculator {
  margin: 80px auto;
  background-color: silver;
  width: 280px;
  padding: 4px 0px 10px 0px;
  border-radius: 10px;
  box-shadow: 10px 10px 10px rgba(0,0,0,0.7);
}

#screen {
  text-align:right !important;
  margin: 8px 11px;
  height: 30px;
  padding: 4px 5px 4px 0px;
  background-color:#F2F2F2;
  font-size: 28px;
  border-radius: 5px;
  color: black;
}

button {
  width: 60px;
  height: 40px;
  margin-bottom: 6px;
  font-size: 20px;
  background-color: #5754EF;
  border-radius: 5px;
  color: white;
  border-style: none;
  outline: 0;
  box-shadow: 2px 2px 2px black;
}

#equal {
  width: 124px;
}

#ac, #del {
  background-color: #b30000;
}

button:hover {
  box-shadow: inset 0 -1px 1px rgba(0,0,0,0), inset 0 1px 2px rgba(0,0,0,0), inset 0 0 0 60px rgba(255,255,0,.5);
}
button:active {
  padding: calc(.25em + 1px) .5em calc(.25em - 1px);
  border-color: rgba(42,35,255,1);
  box-shadow: inset 0 -1px 1px rgba(0,0,0,.1), inset 0 1px 2px rgba(0,0,0,.3), inset 0 0 0 60px rgba(255,255,0,.45);
}






var x = 0;
var y = 0;
var operator = null;
var result = null;


function fixed(floater) {
    return Math.round(floater * 1000) / 1000;
}

function doMath(x, operator, y) {
  
  x = parseFloat(x);
  y = parseFloat(y);
  switch(operator) {
    case "+":
      result = fixed(x + y);
      break;
    case "-":
      result = fixed(x - y);
      break;
    case "x":
      result = fixed(x * y);
      break;
    case "/": 
      result = fixed(x / y);
      break;
    case "%":
      result = fixed(x / y * 100);
      break;
    }
  return result;
}


$("button").click(function() {
  
 
  if ($(this).attr("class") === "num" ) {
    
    if (!operator && x !== result) {
     
      if ($(this).attr("id") === "." || $(this).attr("id") === "0") {
        x = x + ($(this).text());
        $("#screen").text(x);
      }
      else {
      x = parseFloat(x + ($(this).text()));
      $("#screen").text(x);
      }
    }
   
    else if (operator) {
    
      if ($(this).attr("id") === "." || $(this).attr("id") === "0") {
        y = y + ($(this).text());
        $("#screen").text(y);
      }
      else {
      y = parseFloat(y + ($(this).text()));
      $("#screen").text(y);
      }
    }
  }
  
  
  else if ($(this).attr("class") === "op" ) {
   
    if (y) {
      doMath(x, operator, y);
      x = res;
      y = 0;
    }
    operator = $(this).text();
    $("#screen").text(operator);
  }
  
  
  else if ( operator && ($(this).attr("id") === "equal") ) {

    doMath(x, operator, y);
    x = result;
    $("#screen").text(x);
    y = 0;
    operator = null;
  }
  

  else if ($(this).attr("id") === "ac") {
    x = 0;
    y = 0;
    operator = null;
    result = null;
    $("#screen").text(x);
  }
  
  
  else if ($(this).attr("id") === "del") {
    if (x && !operator) {
      x = 0
      $("#screen").text(x);
    }
    else if (x && operator && y) {
      y = 0;
      $("#screen").text(operator);
    }
    else {
      operator = null;
      $("#screen").text(x);
    }
  }
  
});


See the Pen JavaScript Calculator by YaroslavW (@YaroslavW) on CodePen.

CodePen

(36)Build a Wikipedia Viewer

CODEPEN

HTML



<h1 id ="title">Wikipedia Viewer</h1>
<div id="action">
<div>  <a href="http://en.wikipedia.org/wiki/Special:Random" target="_blank" id="random">
    <i class="fa fa-random"> Click here for a random article</i>
  </a></div>
  <input type="text" id="input" placeholder="Search">
  <<i class="fa fa-search" id="searchBtn"></i>
</div>
<div id="main"></div>


CSS



@import url(https://fonts.googleapis.com/css?family=Lato);

#title {
  color: white;
  text-align: center;
  font-size: 3.2rem;
}

body {
  background:#565DB7;
  font-family: 'Lato', sans-serif;
}

.result {
  background: white;
  margin: 1% 3%;
  padding: 1% 2%;
}

a {
  position: relative;
  display: block;
  color: black;
  text-decoration: none;
  font-size:2.2rem;
}

#action {
   text-align: center;
  width: 50%; 
  margin: 30px auto 30px auto;
}

#random {
  display: inline;
}

.fa {
  color: white;
}

#input {
  margin:10%;
  display: inline;
  border-radius: 15px;
  border-style: none;
  outline: none;
  padding: 15px 15px;
}

#searchBtn {
  cursor: pointer;
  font-size:2rem
}


JS



var html;
var link;

$('#input').keydown(function (key) {
  if (key.keyCode === 13) {
    search = $('#input').val();
    callIt();
  
  } 
}); 

$('#searchBtn').click(function(){
  search = $('#input').val();
  callIt();
});

function callIt() {
      $.getJSON( 'https://en.wikipedia.org/w/api.php?action=query&prop=extracts&format=json&exsentences=1&exlimit=max&exintro=&exsectionformat=wiki&generator=search&redirects=&gsrsearch=' + search + '&gsrnamespace=0&callback=?', function( data ) {
  
      
      display(data.query.pages);
    });  
}

function display(data) {
  $('#main').empty();
  $.each(data, function (idx, el) {
    html = '
'; html += '

' + el.title + '

'; html += '

' + el.extract + '

'; $('#main').append(html); }); }


See the Pen Build a Wikipedia Viewer by YaroslavW (@YaroslavW) on CodePen.