z-index: -1
stevemorenoc sends brownie points to @piteto :sparkles: :thumbsup: :sparkles:
:cookie: 200 | @piteto |http://www.freecodecamp.com/piteto
h2 {
color: white
}
.main-wowbg h2 {
margin-top: 200px;
position: absolute;
z-index: 3;
}
<style>
@for $j from 1 to 6 {
.text-#{$j} {font-size:10px * $j;}
}
</style>
<p class="text-1">Hello</p>
<p class="text-2">Hello</p>
<p class="text-3">Hello</p>
<p class="text-4">Hello</p>
<p class="text-5">Hello</p>
.text: for !default
@for $i from 1 to 6
.text-#{$i}
font-size: 60px * $i
Yeah, brackets are not needed in sass
this is how they did it in the challenge example, with brackets
h1tag sends brownie points to @jimtryon and @piteto :sparkles: :thumbsup: :sparkles:
:cookie: 202 | @piteto |http://www.freecodecamp.com/piteto
:cookie: 463 | @jimtryon |http://www.freecodecamp.com/jimtryon
horusofoz sends brownie points to @h1tag :sparkles: :thumbsup: :sparkles:
:cookie: 915 | @h1tag |http://www.freecodecamp.com/h1tag
In Sass, a mixin is a group of CSS declarations that can be reused throughout the style sheet.
Please don’t read this post if you are less than 236 on the map or the “Get Set for our Algorithm Challenges” part as I’m posting an answer to one of the problems.
Please can you guys check this code and tell me if it’s the most effiecient way to fix the problem? I think I can probably improve on the code. Thanks in advance!
``` function titleCase(str) {
var strArr = str.split(" ");
var capF = "";
var newCap = "";
var capWord = "";
var titleCase = [];
for (var i = 0;i < strArr.length; i++) {
strArr[i] = strArr[i].toLowerCase();
capF = strArr[i].charAt(0);
newCap = capF.toUpperCase();
capWord = strArr[i].replace(strArr[i][0], newCap);
titleCase.push(capWord);
}
var sanitisedTitleCase = titleCase.join(' ');
return sanitisedTitleCase;
}
titleCase("I'm a little tea pot");
```
@linkin-park It's spoiler alert :) Yes I should have said that! :)
code
@grahamsnowdon
linkin-park sends brownie points to @grahamsnowdon :sparkles: :thumbsup: :sparkles:
:cookie: 238 | @grahamsnowdon |http://www.freecodecamp.com/grahamsnowdon
@grahamsnowdon
for (var i = 0;i < strArr.length; i++) {
strArr[i] = strArr[i].toLowerCase();
capF = strArr[i].charAt(0);
newCap = capF.toUpperCase();
capWord = strArr[i].replace(strArr[i][0], newCap);
titleCase.push(capWord);
}
can be done in 1 line
for (var i = 0;i < strArr.length; i++) {
titleCase.push( strArr[i].charAt(0) + strArr[i].substr(1));
}
If you lowercase the string before split
grahamsnowdon sends brownie points to @korzo and @linkin-park :sparkles: :thumbsup: :sparkles:
:cookie: 38 | @linkin-park |http://www.freecodecamp.com/linkin-park
:cookie: 585 | @korzo |http://www.freecodecamp.com/korzo
function titleCase(str) {
var strArr = str.toLowerCase().split(" ");
var titleCase = [];
for (var i = 0; i < strArr.length; i++) {
titleCase.push(strArr[i].charAt(0).toUpperCase() + strArr[i].substr(1));
}
return titleCase.join(" ");
}
grahamsnowdon sends brownie points to @longnt80 :sparkles: :thumbsup: :sparkles:
:cookie: 589 | @longnt80 |http://www.freecodecamp.com/longnt80
linkin-park sends brownie points to @grahamsnowdon :sparkles: :thumbsup: :sparkles:
Hi all. Was wondering if I might get some help. Trying to pull a range of numbers from between two arguments given, and make them so they are in descending order. This is my code:
function smallestCommons(arr) {
var mult = [];
for (var x = arr[0]; x <= arr[1]; x++) {
mult.push(x);
}
mult.sort(function(a,b) {
return b-a;
});
return mult;
}
smallestCommons([2,6]);
This works fine, and gives me [6,5,4,3,2].
If I use [6,2] though, or any argument where the first argument is larger than the second, it breaks and returns nothing. Any ideas?
getWeatherAPI
function, or rather trying to use the return value as the JSON data. That is not the correct place to read the data. Your function sends out a request in the $.getJSON
call, but it takes time to get the results back. You have to try to use the data within the callback function for the $.getJSON
call - that is the place where you know that it has returned.
@auricless - for starters, if you change your getJSON call to look like this, you'll see some results
$.getJSON(data, function(json){
console.log(json);
var jsonData = {
weather : json['weather'][0]['main'],
iconSrc : json['weather'][0]['icon'],
temp : json['main']['temp']
}
$("#temp").html(jsonData.weather);
return jsonData;
});
you can see the raw data using the console.log
, and you have to use string values in your bracket notation access of the json
object. Your code to set the temp
property in your object is not correct, so I commented that out. EDIT: I updated the setting for temp
if (arr.indexOf("I") >= 0 && arr.indexOf("II") >= 0 && arr.indexOf("III") >= 0 ||
arr.indexOf("IV") >= 0 && arr.indexOf("V") >= 0 && arr.indexOf("VI") >= 0 ||
arr.indexOf("VII") >= 0 && arr.indexOf("VIII") >= 0 && arr.indexOf("IX") >= 0 ||
arr.indexOf("I") >= 0 && arr.indexOf("IV") >= 0 && arr.indexOf("VII") >= 0 ||
arr.indexOf("II") >= 0 && arr.indexOf("V") >= 0 && arr.indexOf("VIII") >= 0 ||
arr.indexOf("III") >= 0 && arr.indexOf("VI") >= 0 && arr.indexOf("IV") >= 0 ||
arr.indexOf("I") >= 0 && arr.indexOf("V") >= 0 && arr.indexOf("IX") >= 0 ||
arr.indexOf("VII") >= 0 && arr.indexOf("V") >= 0 && arr.indexOf("III") >= 0)
temp
reference to temp : json['main']['temp']
You can also use dot notation to access those values - temp: json.main.temp
would work. Either way is fine - just make sure that you are using string values in the bracket notation.
auricless sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 3340 | @khaduch |http://www.freecodecamp.com/khaduch
h1tag sends brownie points to @linkin-park :sparkles: :thumbsup: :sparkles:
:cookie: 39 | @linkin-park |http://www.freecodecamp.com/linkin-park
linkin-park sends brownie points to @h1tag :sparkles: :thumbsup: :sparkles:
:cookie: 916 | @h1tag |http://www.freecodecamp.com/h1tag
linkin-park sends brownie points to @h1tag :sparkles: :thumbsup: :sparkles:
linkin-park sends brownie points to @h1tag :sparkles: :thumbsup: :sparkles:
linkin-park sends brownie points to @h1tag :sparkles: :thumbsup: :sparkles:
linkin-park sends brownie points to @h1tag :sparkles: :thumbsup: :sparkles:
h1tag sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 3341 | @khaduch |http://www.freecodecamp.com/khaduch
gh05d sends brownie points to @kirbyedy :sparkles: :thumbsup: :sparkles:
:star2: 2125 | @kirbyedy |http://www.freecodecamp.com/kirbyedy
Hi, I was working through this recursion exercise:
// Eloquent solution:
function isEven(n) {
if (n == 0)
return true;
else if (n == 1)
return false;
else if (n < 0)
return isEven(-n);
else
return isEven(n - 2);
}
console.log(isEven(50));
// → true
console.log(isEven(75));
// → false
console.log(isEven(-1));
// → false
Why does n in the 50 or 75 calls get evaluated or coerced to equaling 0 or 1?
feldbot sends brownie points to @jcolborn-dropdeadgames :sparkles: :thumbsup: :sparkles:
:cookie: 220 | @jcolborn-dropdeadgames |http://www.freecodecamp.com/jcolborn-dropdeadgames
jcolborn-dropdeadgames sends brownie points to @feldbot :sparkles: :thumbsup: :sparkles:
:cookie: 316 | @feldbot |http://www.freecodecamp.com/feldbot
kbaig sends brownie points to @feldbot :sparkles: :thumbsup: :sparkles:
:cookie: 317 | @feldbot |http://www.freecodecamp.com/feldbot
fvdave2017 sends brownie points to @mot01 :sparkles: :thumbsup: :sparkles:
:cookie: 870 | @mot01 |http://www.freecodecamp.com/mot01
fvdave2017 sends brownie points to @mot01 :sparkles: :thumbsup: :sparkles:
fvdave2017 sends brownie points to @feldbot :sparkles: :thumbsup: :sparkles:
:cookie: 318 | @feldbot |http://www.freecodecamp.com/feldbot
fvdave2017 sends brownie points to @mot01 :sparkles: :thumbsup: :sparkles:
d
div
whatever else there is
fvdave2017 sends brownie points to @mot01 :sparkles: :thumbsup: :sparkles:
hifede sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 3342 | @khaduch |http://www.freecodecamp.com/khaduch
@jsd540 What URL are you using? That's the base URL you've put in your message, but it should point at one of the endpoints, like streams, channels, or users, and then have a streaming account after that
To answer your question though - it is not down at the moment and the normal twitch API appears to have a very generous limit on the number of calls.
var twitchURL = "https://wind-bow.gomix.me/twitch-api";
twitchURL += '?' + $.param({
'users':'user',
'channels':'channel',
'streams':'stream'
});
$.ajax({
url:twitchURL,
dataType:'jsonp',
success: function(data){
console.log(data);
}
});
?value1=foo&value2=bar
jsd540 sends brownie points to @piteto and @github-henry :sparkles: :thumbsup: :sparkles:
:cookie: 203 | @piteto |http://www.freecodecamp.com/piteto
:cookie: 370 | @github-henry |http://www.freecodecamp.com/github-henry
:bulb: to format code use backticks! ``` more info
.twitchbox{
border:solid black 5px;
max-width:750px;
text-align: center;
margin-top: 20px;
padding: 0;
}
.twitchbox a {
display: inline-block;
border:solid black 1px;
min-width:150px;
width: calc(100% / 4 - 20px);
height:150px;
margin: 0px 10px 10px 10px;
background-color:white;
border-top:solid #4d4dff 5px;
}
@media (max-width: 720px) {
.twitchbox a {
width: calc(100% / 3 - 20px);
}
}
@media (max-width: 550px) {
.twitchbox a {
width: calc(100% / 2 - 20px);
}
}
@media (max-width: 395px) {
.twitchbox a {
width: calc(100% - 20px);
}
}
amthomps11 sends brownie points to @piteto :sparkles: :thumbsup: :sparkles:
:cookie: 204 | @piteto |http://www.freecodecamp.com/piteto
@amthomps11 It would look something like:
<div class="twitchbox container">
<div class="row">
<div class="col-lg-3 col-md-4 col-sm-6 col-xs-12">
your twitch user card html goes here, add the class online or offline to the parent div for filtering
</div>
<!-- repeat the div above for each twitch streamer -->
</div>
</div>
Since you're on the last intermediate front-end project, I wouldn't recommend moving forward to another project until you get comfortable with the grid system: https://getbootstrap.com/docs/3.3/css/#grid
hashtagyolo1 sends brownie points to @gersho :sparkles: :thumbsup: :sparkles:
:cookie: 518 | @gersho |http://www.freecodecamp.com/gersho
hashtagyolo1 sends brownie points to @gersho :sparkles: :thumbsup: :sparkles:
for(var i = 0; i <= 10; i++) {
console.log(i); // 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
setTimeout(function() {
console.log(i); // 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11
});
}
hashtagyolo1 sends brownie points to @gersho :sparkles: :thumbsup: :sparkles:
mers89 sends brownie points to @mot01 and @korzo :sparkles: :thumbsup: :sparkles:
:cookie: 871 | @mot01 |http://www.freecodecamp.com/mot01
:cookie: 586 | @korzo |http://www.freecodecamp.com/korzo