Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Aug 17 09:32
    User @bjorno43 unbanned @linkin-park
  • Jun 20 21:19
    @bjorno43 banned @shenerd140
  • Apr 25 17:13
    @mstellaluna banned @cmal
  • Jan 08 22:05
    @mstellaluna banned @dertiuss323
  • Nov 07 2018 04:42
    User @texas2010 unbanned @ows-ali
  • Nov 02 2018 16:25
    @texas2010 banned @ows-ali
  • Oct 12 2018 05:50
    @bjorno43 banned @NACH74
  • Oct 05 2018 23:02
    @mstellaluna banned @JomoPipi
  • Sep 16 2018 12:21
    @bjorno43 banned @yash-kedia
  • Sep 16 2018 12:16
    @bjorno43 banned @vnikifirov
  • Sep 05 2018 08:12
    User @bjorno43 unbanned @androuino
  • Sep 05 2018 07:38
    @bjorno43 banned @androuino
  • Aug 23 2018 16:57
    User @bjorno43 unbanned @rahuldkjain
  • Aug 23 2018 16:23
    @bjorno43 banned @rahuldkjain
  • Jul 29 2018 14:13
    User @bjorno43 unbanned @jkyereh
  • Jul 29 2018 01:00
    @bjorno43 banned @jkyereh
  • Jul 10 2018 22:09
    @bjorno43 banned @manafn
  • Jul 06 2018 15:20
    @texas2010 banned @imlegend19
  • Jul 03 2018 12:28
    @bjorno43 banned @vbvmatta
  • Jun 29 2018 13:54
    @bjorno43 banned @OGTechnoBoy
grantknaver
@grantknaver
helpful :)
Kevin
@KevinBruland
here we go
sorry that took so long
so you can see in that example, if data.stream is false, the if statement on line 11 wont fire
so it then goes to the else on line 14, and calls getChannel, passing the channel that did not have data.stream
grantknaver
@grantknaver
I like ajax alot more
Kevin
@KevinBruland
the way you did it?
grantknaver
@grantknaver
no I used getJSON
Kevin
@KevinBruland
ah, right
grantknaver
@grantknaver
I like $.ajax more
Kevin
@KevinBruland
I do too, but you can do simpler getJSON calls as well
Martine Ross
@moi238
@sziko no problem just glad it worked
Baha Aiman
@bhshkh
Thanx @sorinr
CamperBot
@camperbot
bahaaiman sends brownie points to @sorinr :sparkles: :thumbsup: :sparkles:
:star2: 1013 | @sorinr |http://www.freecodecamp.com/sorinr
Baha Aiman
@bhshkh
For wikipedia viewer I'm getting the error : "Refused to execute script from 'https://en.wikipedia.org/w/api.php?%20%20%20%20format=json%20%20%20%20&acti…plaintext%20%20%20%20&exsentences=1&exlimit=max&gsrsearch=Albert&callback=?' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled."
Please help
var app = angular.module('wikiApp', []);
app.controller('myCtrl', function ($scope, $http) {
    $scope.searchUrl = `https://en.wikipedia.org/w/api.php?
    format=json
    &action=query
    &generator=search
    &gsrnamespace=0
    &gsrlimit=10
    &prop=pageimages|extracts
    &pilimit=max
    &exintro
    &explaintext
    &exsentences=1&exlimit=max&gsrsearch=Albert&callback=?`;

    $http.jsonp($scope.searchUrl)
        .success(
        function (data) {
            var results = data.query.pages;
            angular.forEach(results, function (v, k) {
                $scope.results.push({ title: v.title, body: v.extract, page: page + v.pageid })
            })

        });



});
Here's the code
Sorin Ruse
@sorinr
@BahaAiman think you should add into the url that you request a json dataType return. just a sec
Sorin Ruse
@sorinr
@BahaAiman maybe here format=json you should have &format=json
snehashisc
@snehashisc
did that work?
the above code looks good to me. Just append '&'
Minoy
@minoy
Hello everyone!
I am stuck with the 'Counting Cards' Javascript challenge

Following is the code:
var count = 0;

function cc(card) {
// Only change code below this line
switch (card) {
case 2:
case 3:
case 4:
case 5:
case 6:
count += 1;
break;
case 7:
case 8:
case 9:
count += 0;
break;
case 10:
case 'J':
case 'Q':
case 'K':
case 'A':
count -= 1;

}

if (count <= 0) {
console.log (count + " Hold");
} else
console.log (count + " Bet");

//return count;
// Only change code above this line
}

// Add/remove calls to test your function.
// Note: Only the last will display

cc(2); cc(3); cc(4); cc(5); cc(6);

I am not getting any output. Any ideas?

Ayobami
@purpose50

Hi guys, i dont know what the problem is here, my s function stream keeps returning undefined when the returned value is defined..
my Code:

$(document).ready(function() {
  var channels = ["ESL_SC2", "OgamingSC2", "cretetion", "freecodecamp", "storbeck", "habathcx", "RobotCaleb", "noobs2ninjas"];

  function stream(channel) {
    var streamResult;
    var stream_link =  "https://wind-bow.gomix.me/twitch-api/streams/" + channel;
    $.getJSON(stream_link, function(result) {
      streamResult = result.stream;
    });

   return streamResult;
  }//end function stream

  alert(stream("ESL_SC2"));

  function channelInfo(stream, channel) {
    //var status = stream(channel);
    if(status === null) {
      var channel_status = "offline";
    }else {
      var channel_status = "online";
    }//end else

    var link = "https://wind-bow.gomix.me/twitch-api/channels/" + channel;
      $.ajax({
      url: link,
      dataType: "jsonp",
      success: function(json) {   
        $(".table").append("<tr><td><img src = '" + json.logo + "' width = '320'></td>");
        $(".table").append("<td>" + json.display_name + "</td>");
        $(".table").append("<td>" + channel_status + "</td></tr>");
      }//end success
    });//end $.ajax
  }//end channelInfo

  for(i = 0; i < channels.length; i++) {
   channelInfo(stream, channels[i]);
  }//end for
});///end document

codepen: http://codepen.io/purpose/pen/dOBxJy

any help please

alpox
@alpox
@purpose50 $.getJSON is an asynhronous call. That means, that the callback function given to it resolves late, and the code doesn't wait for it with running. so streamResult is not YET set when you return.
You will have to restructure your code accordingly.

When you want to encapsulate that stuff in a function still, you can use something like:

function stream(channel, cb) {
    var streamResult;
    var stream_link =  "https://wind-bow.gomix.me/twitch-api/streams/" + channel;
    $.getJSON(stream_link, function(result) {
      cb(result.stream);
    });
  }

And use it as:

stream("ESL_SC2", function(stream) {
    // here you have the stream
});
Paweł Rokosz
@PawelRokosz
hey, is it possible to design a html/css/js responsive project in which every section has the height of a device with a 100% fluid width?
alpox
@alpox
@PawelRokosz Sure
section {
    height: 100vh;
    width: 100%;
}
Paweł Rokosz
@PawelRokosz
@alpox awesome! Thank you!
CamperBot
@camperbot
pawelrokosz sends brownie points to @alpox :sparkles: :thumbsup: :sparkles:
:cookie: 713 | @alpox |http://www.freecodecamp.com/alpox
marko bogdanovic
@okramovic
in need of help with wiki challenge. why do i have empty myData?
http://codepen.io/okramovic/pen/woVKXB
Luke Sallmen
@LukeSallmen
Hey. I'm trying to make my links in my navbar entirely clickable - the whole block, not just the text - but I'm having trouble doing so. Is it possible to turn my text links into "blocks" in the navbar that are entirely clickable?http://codepen.io/LukeSallmen/pen/qqeWoR
Phillip Troutman
@troutman21
It looks like the whole thing is clickable from my side @LukeSallmen
Sara Soliman
@solimansara
Good Morning, do i need to include the google font link at the beginning of the page when i am using A Pen?
Phillip Troutman
@troutman21
only if you want a specific type of font that is not already supported by your bootstrap or something
Sara Soliman
@solimansara
Are most of the fonts supported by bootstrap?
Phillip Troutman
@troutman21
I think the basic ones are. Im still very new so i dont have a lot of experience with changing fonts. However I'm going to experiment with some new ones from google just to practice.
@solimansara
Sara Soliman
@solimansara
Cool, how do you know if the font wanted is supported or not?
Luke Sallmen
@LukeSallmen
@troutman21 more specifically I want the space above and around the text/anchor to be clickable as well
Icah Banton
@remdata
need help with the portfolio challenge. Can you use a codePen page as a responsive image?
Luke Sallmen
@LukeSallmen
@remdata what do you mean?
Icah Banton
@remdata
@LukeSallmen . I am trying to use a codePen as a thumbnail.