Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Very Curious!!!

I am a novice in JavaScript, now I actually respect people who build dynamic websites or applications, certainly it is not an easy thing to do, I mean even floats in css kicked my ass.

But I'm very curious about how this markdown sheet works?? May be it's just a simple thing thing to do, for me it is fascinating how just by typing three backticks and the name of the language Walaaah! You have all you need.

How markdown sheet works actually??

Sorry may be an irrelevant question but nowadays I see each and every website and application critically (I think something is wrong with me :p).

6 Answers

Hi Tushar!

Curiosity is good! Markdown is really cool, and it's definitely not just here in the treehouse forums. The tech writer John Gruber, of Daring Fireball, created Markdown, and it's become a very broadly used markup language used by bloggers, and to create readme files (every readme.md file on GitHub is a markdown file, hence the .md). Markdown is then converted into html. I recommend reading more about all the things you can do over on Daring Fireball. The Wikipedia page may also interest you. Note that not all features of Markdown are supported here in the forums. Experiment! You can use the preview button to see if you're getting the results you want.

Bonus

You can also use markdown to generate emoji. :+1:

Thanks ;)

HI greg I was wondering If you could help me again, head over to the this link please

https://teamtreehouse.com/community/twitch-api

Hey Tushar,

It looks like you're making some good progress on your own, which is great. Here's the workflow I would suggest when working with a new (to you) technology like this:

  1. Read the documentation
  2. Try stuff
  3. If you get stuck, look at more documentation
  4. If you're still stuck, look around for answers online
  5. If you can't find any, or you find things that almost but not quite answer your question, post something here

The Treehouse forums are a great place to get help from your fellow students, but you're much more likely to get a solid answer if you have a very specific question, and an explanation of what you've tried so far, preferably with some code, and what specific thing you can't get to work. Remember who's here in the forum - mostly people learning the basics of the language, and the specific outside technologies and APIs that are taught here. I don't personally know the first thing about the Twitch API, so I can't help with this question - hopefully someone else will, but there are probably better places to ask about Twitch, specifically.

Good luck :)

Thanks , I 'll look into it and if I get stuck I'll be more specific with some code.After learning Ajax Baiscs, again I was VERY CURIOUS how can I use other apis'. I'll come up with something and then I 'll share. Thanks for your support. So far, I've managed to create 2 apps, not good but I wanted to focus on the functionality. Next Twitch. http://codepen.io/tushar_13/full/WwXVGB/ http://codepen.io/tushar_13/full/RaZGmW/

Very cool - nice work!

Hi, stuck again , a little hint please! I can't understand if you can't help me, there's a lot of code and you are not familiar with twitch. SO it's allright. http://codepen.io/tushar_13/full/ZWvOwg/

When a user clicks online button, he should see only channels currently streaming, same with offline.

<div class="container">

  <header>
    <ul class="nav nav-pills nav-justified">
    <li id="all"><a href="#">All</a></li>
      <li id="online"><a href="#">Online</a></li>  <!-- using online id-->
      <li id="offline"><a href="#">Offline</a></li>
      </ul>
  </header>
  <div id="slogan">
  <h3>"Streaming live video broadcasts for Everyone"</h3>
  </div>
  <div id="search-section">
    <input type="text" placeholder="&#128269" id="search">
  </div>

  <div id="main-section"></div>
</div>
// work on input section
// work on buttons

$(document).ready(function () {
// twitchers list(array)
var twitchers = ["freecodecamp",  "MEDRYBW", "storbeck", "terakilobyte", "habathcx","RobotCaleb","thomasballinger","noobs2ninjas","beohoff"];
  // variables
 var name;
 var statusSign;
 var logo;
  var status;
  var statusOF;

  // input field(working on it)
  $('#search').keyup(function(){
    var input = $(this).val().toLowerCase();

  });//end keyup

  // loop through the twithers
  twitchers.forEach(function(user) {
    // channel endpoint url
var channelUrl ="https://api.twitch.tv/kraken/channels/"+user+ '?callback=?';
    // streams endpoint url
var streamUrl = "https://api.twitch.tv/kraken/streams/"+ user+'?callback=?';

    // get json
    $.getJSON(channelUrl, function(channel) {
      $.getJSON(streamUrl ,function(stream) {
        // if twitcher is not streaming
        if(stream.stream == null) {
          // add particular img
          statusSign = '<i class="fa fa-times fa-2x offline"></i>';      //offline class because not streaming
          // not streaming -just displaying it
          status = "Currently Not Streaming";
          // simply means twitcher is offline
          statusOF ="Offline"
 // if twitcher is streaming same steps with a different icon
        } else {
          statusSign = '<i class="fa fa-check fa-2x online"></i>';
          status=channel.status;
          statusOF ="Online";
        }
        // storing display name into a variable for ease of use
        name = channel.display_name;
    // if twitcher has no logo, use a default img
        if (channel.logo == null) {
          channel.logo = 'http://www.trickyladygaming.com/wp-content/uploads/2015/10/Twitch-Icon-150x150.png'
        } 
 // time to see some action
 // created html variable to gather the information
// later append it to the div with id main-section        
var html = '<div class="sub-section">';                    // sub-section class
html+= '<ul><li>';
html += '<img src="'+channel.logo+'">';
html+= '<span class="title">Title: ';
html+= '<a href="https://www.twitch.tv/'+user+'">'+name+'</a></span><br>';
html+= statusSign;
html+= '<span class="statusOF">'+statusOF+'</span><br>';
html+= '<span class="status">'+status+'</span></li></ul></div>'        

// append it to the document
 $(html).appendTo("#main-section");


    // working on buttons    
   $('#online').click(function(){
      $(".sub-section").each(function() {
      if ($(this).hasClass('offline')) {
        $(this).hide();
      } else {
        $(this).show();
      }
      });
   });


      })// end streams json
    })// end channels json
  });// end each
}); // end ready

Specially look at this section, what am I doing wrong?I have marked all the ids and classes

 $('#online').click(function(){
      $(".sub-section").each(function() {
      if ($(this).hasClass('offline')) {
        $(this).hide();
      } else {
        $(this).show();
      }
      });
   });

It's working for me - maybe you've fixed it?

yup I fixed it ;) Thanks anyway

ok I have should have used emoji lol :smile: