26th
Jan 2018
jusgoose
@gusd773
Jan 26 2018 02:42

"caesars-cipher"

not sure why it hates me :(

/*

function rot13(str) { // LBH QVQ VG!
var newStr= "";
for (var i=0; i<str.length+1; i++){

var oriGin = str.charCodeAt(i);
if (65<=oriGin<=90){
oriGin = oriGin - 13;
newStr = newStr.concat(String.fromCharCode(oriGin));

}

else {newStr = newStr.concat(String.fromCharCode(oriGin));}

}
return newStr;
}

// Change the inputs below to test
rot13("SERR PBQR PNZC");

*/

Claudio Restifo
@Marmiz
Jan 26 2018 03:06

@gusd773 you are not account the cyclical nature of the cypher:

I I want to transform the letter A (65 in ascii), I should "go back" in the alphabets from 13 positions, but since A is the first letter I should start decreasing from Z, Y, X ....resulting in A --> N.

Instead you are simply reducing the ASCII of 13, so A (65 - 13 = 52) that is 4 :)

makes sense?

jusgoose
@gusd773
Jan 26 2018 03:15
@Marmiz gotcha, so I'm adding another if statement
Claudio Restifo
@Marmiz
Jan 26 2018 03:16
@gusd773 that's a possible solution :)
jusgoose
@gusd773
Jan 26 2018 03:21

@Marmiz

'
function rot13(str) { // LBH QVQ VG!
var newStr= "";

for (var i=0; i<str.length+1; i++){

var oriGin = str.charCodeAt(i);
if (78<=oriGin<=90){
oriGin = oriGin - 13;
newStr = newStr.concat(String.fromCharCode(oriGin));

}
if (65<=oriGin<=77){
oriGin = oriGin+13;
newStr = newStr.concat(String.fromCharCode(oriGin));

}

else {newStr = newStr.concat(String.fromCharCode(oriGin));}

}
return newStr;
}

// Change the inputs below to test
rot13("SERR PBQR PNZC");
'
I thought this would work but I guess not

Claudio Restifo
@Marmiz
Jan 26 2018 03:22
jusgoose
@gusd773
Jan 26 2018 03:24
will do @Marmiz
deaninous
@deaninous
Jan 26 2018 03:26
Try
jusgoose
@gusd773
Jan 26 2018 03:37
@deaninous i'm trying
jusgoose
@gusd773
Jan 26 2018 03:54

I tried returning the middle "if" statement and it returns the right unicode but for some reason does not want to work the way the first if statement is working plz somebody help :(

/*
function rot13(str) { // LBH QVQ VG!
var newStr= "";

for (var i=0; i<str.length+1; i++){

var oriGin = str.charCodeAt(i);
if (78<=oriGin<=90){
oriGin = oriGin - 13;
newStr = newStr.concat(String.fromCharCode(oriGin));

}
if (65<=oriGin<=78){
oriGin = oriGin+13;

newStr = newStr.concat(String.fromCharCode(oriGin));

}

else {newStr = newStr.concat(String.fromCharCode(oriGin));}

}
return newStr;
}

// Change the inputs below to test
rot13("SERR PBQR PNZC");
*/

Claudio Restifo
@Marmiz
Jan 26 2018 03:55
@gusd773 well, it's worth looking into this condition:
(78<=oriGin<=90)
jusgoose
@gusd773
Jan 26 2018 04:00
@Marmiz that doesn't help i copied n pasted it lol thinking it would do what it did for the latter half of my domain
Claudio Restifo
@Marmiz
Jan 26 2018 04:03

@gusd773 I just want to guide you in understanding your function... I won't give you any straight up correction :)

My question is: do you think this is correct?
(78<=oriGin<=90)

Have you actually tried it?
like for example, if I write this:

1 <= 5 <= 3

What do you expect? true or false?

jusgoose
@gusd773
Jan 26 2018 04:04
@Marmiz haha I'm not one for that either thank you
CamperBot
@camperbot
Jan 26 2018 04:04
gusd773 sends brownie points to @marmiz :sparkles: :thumbsup: :sparkles:
:star2: 1132 | @marmiz |http://www.freecodecamp.org/marmiz
jusgoose
@gusd773
Jan 26 2018 04:05
@Marmiz false
Claudio Restifo
@Marmiz
Jan 26 2018 04:06
@gusd773 and what actually happen if you try it?
@ezioda004
Jan 26 2018 04:06
So you'd expect, but js and math doesnt go together
jusgoose
@gusd773
Jan 26 2018 04:07
math major here sorry
I love puzzles** so yea here I am
Claudio Restifo
@Marmiz
Jan 26 2018 04:08
@gusd773 I understand your thought process, but have you actually try it?
The fact that makes sense to you, does not necessarly means make sense for the machine
go into your browser console and type: 1< 5 <3 and see the output the machine give to you
jusgoose
@gusd773
Jan 26 2018 04:09
true my world is now upside down
@Marmiz has killed my dev innocence
Claudio Restifo
@Marmiz
Jan 26 2018 04:13
@gusd773 or stimulated you into a more critical thinking... you choose which one you prefer ;)
Claudio Restifo
@Marmiz
Jan 26 2018 05:10
@gusd773 how's the function coming along?
Fabien SHAN
@X140hu4
Jan 26 2018 06:42
Hello, I am doing the javascript calculator project atm. I have an handleclick on the buttons of my calculator. It fires a function that has a switch statement to catch what button has been pushed and the related code to run. For 3 operations (-, x, /) I am using an HTML code (&#247; for division) but when checking for the value case val = "&#247;" it does not return true.
Anyone has an idea of how to handle this?
Pieter Stokkink
@forkerino
Jan 26 2018 06:45
You can console.log the val in the default clause and copy paste it to the case
Maybe that works
Fabien SHAN
@X140hu4
Jan 26 2018 06:46
Yeah I thought of that and it does but what if I have to use the html code?
Pieter Stokkink
@forkerino
Jan 26 2018 06:46
Maybe switch on charcode?
Or use id's in your html and use those
Fabien SHAN
@X140hu4
Jan 26 2018 06:48
Well, going to do the copy paste workaround for the moment
what do you mean?
Pieter Stokkink
@forkerino
Jan 26 2018 06:48
When you give an id of 'divide' to the button, you can switch on that
On my phone, so not gonna type out an example. ☺
But it should be on the 'event.target' somewhere
Fabien SHAN
@X140hu4
Jan 26 2018 06:54
thanks
thanks for the input @forkerino
CamperBot
@camperbot
Jan 26 2018 06:54
x140hu4 sends brownie points to @forkerino :sparkles: :thumbsup: :sparkles:
:star2: 2975 | @forkerino |http://www.freecodecamp.org/forkerino
Pieter Stokkink
@forkerino
Jan 26 2018 06:55
You're welcome!
sabahatullah
@sabahatullah
Jan 26 2018 09:22

morning guys, is that a good idea to use "const"?
product_id, product_subcategory are dynamic in the following
const newObject = Object.assign(defaultObj, {
entity: {
id: product_id,
categoryId: product_subcategory
}
});

return newObject;

Markus Kiili
@Masd925
Jan 26 2018 09:37
@sabahatullah Here it doesn't matter whether you use let (or var) or const. const only protects against re-assignment to the variable. Most people who write ES6, use only const and let, and forget about var.
Maybe you should use const when you are not going to reassign.
sabahatullah
@sabahatullah
Jan 26 2018 10:01
@Masd925 please correct me. if I put this code on the website and product id is different on on each page it won't give out any error. I am actually confused as I read it is used for constant only. re assigning gives error
and also if they are multiple product ids on the same page then
Markus Kiili
@Masd925
Jan 26 2018 10:02
@sabahatullah Because there is a return at the end, that code must be within a function. Each time the function is called, a new constant is created and then returned. No problem there.
The function would do the same if it was let or var.
Simon Cordova
@gbsimon87
Jan 26 2018 10:30
Hey all!
Was wondering if anyone knew how to add a class to all children of an element using vanilla JS?
Marianissimus
@Marianissimus
Jan 26 2018 10:31
@gbsimon87 could work with a loop and classList.add method?
Simon Cordova
@gbsimon87
Jan 26 2018 10:32
@Marianissimus I've only got two elements to add the classes to
Marianissimus
@Marianissimus
Jan 26 2018 10:32
ok, select them and use classList.add("classname");
Blauelf
@Blauelf
Jan 26 2018 10:36

So something like

for (let child of myNode.children) {
}

or ES5 equivalent

var children = myNode.children;
for (var i = 0; i < children.length; i++) {
}

?

Simon Cordova
@gbsimon87
Jan 26 2018 10:37
@Blauelf thank you
Which of this is more modern?
CamperBot
@camperbot
Jan 26 2018 10:37
gbsimon87 sends brownie points to @blauelf :sparkles: :thumbsup: :sparkles:
:star2: 4677 | @blauelf |http://www.freecodecamp.org/blauelf
Simon Cordova
@gbsimon87
Jan 26 2018 10:38
I'd suppose using a for in loop has better readability, I think I will try that
Blauelf
@Blauelf
Jan 26 2018 10:39
That's for of, not for in. ES6 loop type over values, while for in loops over the keys (which are not of interest here).
Simon Cordova
@gbsimon87
Jan 26 2018 10:39
Thank you, I was just researching the diff for a for of
Marianissimus
@Marianissimus
Jan 26 2018 10:39
is children array? I don't think so
Markus Kiili
@Masd925
Jan 26 2018 10:39
@gbsimon87 classList and appending to className differ on browser compatibility.
Simon Cordova
@gbsimon87
Jan 26 2018 10:40
I'm only concerned for mobiles atm and it appears classList works well
Marianissimus
@Marianissimus
Jan 26 2018 10:40
children.constructor === Array //false. so a for loop is needed;
Simon Cordova
@gbsimon87
Jan 26 2018 10:40
var slideImg = container.querySelectorAll(".upYourCallTop > img");
var slideBottomChildren = container.querySelectorAll(".upYourCallBottom");

function showSlide(index) {
console.log("UNIPRO:showSlide", index)
slides[currentIndex].classList.remove('upYourCallActive')

currentIndex = index

// for (var i = 0; i < childNodes.length; i++) {
// }

for (let child of slideBottomChildren.children) {
console.log(child);
}
}
That's what I've got so far
Blauelf
@Blauelf
Jan 26 2018 10:41
@Marianissimus It's an array-like, not an array, as far as I know, so you cannot just write myNode.children.forEach(...). You could however use Array.prototype.forEach.call(myNode.children, ...)
Marianissimus
@Marianissimus
Jan 26 2018 10:41
ok, thanks
Markus Kiili
@Masd925
Jan 26 2018 10:42
Yes, NodeList has forEach, but HTMLCollection doesn't.
Blauelf
@Blauelf
Jan 26 2018 10:42
NodeList? What's that?
Oh, looked it up. Nice.
Simon Cordova
@gbsimon87
Jan 26 2018 10:42
Not an array but can iterate through it
Weird?!?
Markus Kiili
@Masd925
Jan 26 2018 10:43
@Blauelf For example querySelectorAll returns a NodeList.
@gbsimon87 It is easy to use any array methods on array-like object the way @Blauelf showed.
Simon Cordova
@gbsimon87
Jan 26 2018 10:44
This is honestly one of those times where jQuery does makes things easier, I'm just really trying to go the vanilla route
Thanks everybody for the help I do appreciate it
Blauelf
@Blauelf
Jan 26 2018 10:48
@Masd925 Again, I feel like browser APIs have changed with the addition of CSS. Having learnt HTML and JavaScript for the first time over 20 years ago. Before CSS was even a thing. Tables and frames for layout (and people with text browsers complaining about tables and frames being used for layout).
And me writing server-side code in ColdFusion, with all those SQL injections possible because I just concatenated strings for the SQL query...
Tiago Correia
@tiagocorreiaalmeida
Jan 26 2018 10:54
hello everyone
im a bit confused
ele.cover ? ele.cover.url : ele.screenshots ? ele.screenshots[0].url : ""
we can do this right?
Markus Kiili
@Masd925
Jan 26 2018 10:56
@tiagocorreiaalmeida You can but you should not.
Tiago Correia
@tiagocorreiaalmeida
Jan 26 2018 10:56
what problems does it creates?
Markus Kiili
@Masd925
Jan 26 2018 10:56
@tiagocorreiaalmeida Hard to read and understand.
Tiago Correia
@tiagocorreiaalmeida
Jan 26 2018 10:56
uh ok but I think in my case makes sense
let me show
).then((response) => {
if (!response.data && offset > 0) return res.error(409, "all-games-listed");
if (!response.data) return res.error(409, "not-found");
let data = response.data.map((ele) => ({
id: ele.id,
name: ele.name,
url: ele.url,
summary: ele.summary,
cover: ele.cover ? ele.cover.url : ele.screenshots ? ele.screenshots[0].url : "",
rating: ele.total_rating ? ele.total_rating : "Not defined"
}));
//filter the user wishlist missing
res.send(data);
})
Blauelf
@Blauelf
Jan 26 2018 10:57

@tiagocorreiaalmeida Sure one can. It's not exactly readable.

Also, in your case, does a truthy ele.screenshots imply there exists an ele.screenshots[0]?

Tiago Correia
@tiagocorreiaalmeida
Jan 26 2018 10:57
yeah it does cause the object doesnt contains the proprety if there's no values at all
Markus Kiili
@Masd925
Jan 26 2018 10:58
@tiagocorreiaalmeida You should at least put parens around the third ternary operand.
Tiago Correia
@tiagocorreiaalmeida
Jan 26 2018 10:59
ok thanks @Masd925 how would you do it tough?
CamperBot
@camperbot
Jan 26 2018 10:59
tiagocorreiaalmeida sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 4671 | @masd925 |http://www.freecodecamp.org/masd925
Blauelf
@Blauelf
Jan 26 2018 11:04

I would probably just change the indentation, like

            summary: ele.summary,
cover: (
ele.cover ? ele.cover.url
: ele.screenshots ? ele.screenshots[0].url
: ""
),
rating: ele.total_rating ? ele.total_rating : "Not defined"

(parentheses because I might confuse it with the colons of the object literal)

Markus Kiili
@Masd925
Jan 26 2018 11:07
@tiagocorreiaalmeida I generally like tests to be explicit, so I don't have to go looking all around the code for explanation about what the test is doing. So if(str!=="") instead of if(str) and if(obj!==null) or if(obj!==undefined) instead of if(obj).
Tiago Correia
@tiagocorreiaalmeida
Jan 26 2018 11:08
ok thanks both for pointing better ways of doing it
Blauelf
@Blauelf
Jan 26 2018 11:13
@Masd925 Good idea. The comparison makes clear this thing is a boolean. What about ill-named functions returning booleans (not prepended by some "is"), would you add === true?
Markus Kiili
@Masd925
Jan 26 2018 11:19
@Blauelf Don't know. But proper naming would be the best way.
shigaoping
@shigaoping
Jan 26 2018 11:20

// 请把你的代码写在这条注释以下
for(var i=0;i<contacts.length;i++){
if(firstName==contacts[i].firstName){
if(contacts[i].hasOwnProperty(prop)){
return contacts[i][prop];
}
else return "No such property" ;
}
else return "No such contact";
}

// 请把你的代码写在这条注释以上
}where is the priblem?

Blauelf
@Blauelf
Jan 26 2018 11:21
@shigaoping What if the first person isn't the one you search for? You instantly return "No such contact", without even looking at the second contact. On a name mismatch, keep iterating, and return "No such contact" only after the loop.
shigaoping
@shigaoping
Jan 26 2018 11:31
The loop has a mistake.
@Blauelf thanks
CamperBot
@camperbot
Jan 26 2018 11:34
shigaoping sends brownie points to @blauelf :sparkles: :thumbsup: :sparkles:
:star2: 4678 | @blauelf |http://www.freecodecamp.org/blauelf
ESLMiguel
@ESLMiguel
Jan 26 2018 13:44

Looking at this code:

var a = 1;
var b = 2;
(function(){
var b = 3;
a += b;
})();
alert(a+b);

1) Why does var a evaluate as 3 when alert is called?
2) What function or syntactical reason is the () in line 6?

Markus Kiili
@Masd925
Jan 26 2018 13:50
@ESLMiguel When alert is called, a is 4 and b is 2.
() executes the function created by the expression immediately.
ESLMiguel
@ESLMiguel
Jan 26 2018 14:07
I didnt not know that () did that. interesting. why is b = 2 at the time alert is called and not = 3?
is it because the code is var b = 3 and not b = 3?
Markus Kiili
@Masd925
Jan 26 2018 14:13
@ESLMiguel JS has function scope so:
var a = 1;     // Makes a global variable a
var b = 2;     // Makes a global variable b
(function(){   // Makes a function that is executed immediately by the () below
var b = 3;  // Makes a function scope (local) variable b
a += b;     // Uses the global variable a and local variable b
})();
alert(a+b);    // Uses global variables a and b
ESLMiguel
@ESLMiguel
Jan 26 2018 14:41
@Masd925 Thanks for the clear explanation!
CamperBot
@camperbot
Jan 26 2018 14:41
eslmiguel sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 4673 | @masd925 |http://www.freecodecamp.org/masd925
Tom
@moT01
Jan 26 2018 14:47
is there a difference in these in performance?
document.getElementById('slideshow').addEventListener('click', function() {
document.getElementById('slide').setAttribute('src', '../public/img/slide2.jpg');
});

var slide = document.getElementById('slide');
slide.setAttribute('src', '../public/img/slide2.jpg');
});
Sweet Coding :)
@SweetCodingInc
Jan 26 2018 14:56
@moT01 Yes.. 2nd one is more performant
dom operations are expensive and with first approach you access the dom every time you click the said element
in 2nd, you cache the reference to #slide once and then use the reference upon each click
Tom
@moT01
Jan 26 2018 15:00
@SweetCodingInc thanks, i kinda assumed something like that - just wanted a second opinion
CamperBot
@camperbot
Jan 26 2018 15:00
mot01 sends brownie points to @sweetcodinginc :sparkles: :thumbsup: :sparkles:
Sweet Coding :)
@SweetCodingInc
Jan 26 2018 15:17
@moT01 :+1:
Jason Luboff
@JLuboff
Jan 26 2018 16:11
:wave:
Kaz Baig
@kbaig
Jan 26 2018 16:14
@JLuboff :wave: :clap:
Jason Luboff
@JLuboff
Jan 26 2018 16:14
What up
Kaz Baig
@kbaig
Jan 26 2018 16:14
@JLuboff I'm done with that project! (almost, just need to deploy it after it gets approved)
Jason Luboff
@JLuboff
Jan 26 2018 16:15
@kbaig Awesome, good job! I mean..you are a week late..but.. :P
Kaz Baig
@kbaig
Jan 26 2018 16:20
...
Still working a little but not much on the front end
Jason Luboff
@JLuboff
Jan 26 2018 16:37
@kbaig Looks good. What framework did you use for the frontend?
Or is that normal Wolfram frontend look?
Kaz Baig
@kbaig
Jan 26 2018 16:38
@JLuboff I don't really control the look, just the layout. You can pick from like three different themes
Jason Luboff
@JLuboff
Jan 26 2018 16:39
Ah. It's very bootstrap'ish but not default bootstrap...more like a bootstrap theme
Kaz Baig
@kbaig
Jan 26 2018 16:40
Sounds about right from our devs lol
Jason Luboff
@JLuboff
Jan 26 2018 16:40
:joy:
Kaz Baig
@kbaig
Jan 26 2018 16:42
Ay who submitted something with 51 as entries
Jason Luboff
@JLuboff
Jan 26 2018 16:42
Not me.. I didn't submit anything, just looked at it. Wasn't sure if it was live and didn't want to get you in trouble haha
Kaz Baig
@kbaig
Jan 26 2018 16:42
LOL no it's on my account
not on the production one
Jason Luboff
@JLuboff
Jan 26 2018 16:44
:+1:
Ugh...I think I might spring for the monthly github charge so I can have private repos..
Nazar
@IsaakNazar
Jan 26 2018 16:52
hi guys, I'm learning a tutorial and there is a code
document.querySelector('audio[data-key="${e.keyCode}"]') what that dollar sign means? I have no idea jusgoose @gusd773 Jan 26 2018 16:52 @Marmiz i fell asleep I seriously have never felt more lost in any challenge, usually after a hint or two I can figure it out as I am a man of fundamentals but if you could maybe link me to something I could read that would help Kaz Baig @kbaig Jan 26 2018 16:53 @IsaakNazar Are you sure they using quotation marks " and not backticks   Nazar @IsaakNazar Jan 26 2018 16:53 @kbaig yes, I am @kbaig yes its actually backticks :) Jason Luboff @JLuboff Jan 26 2018 16:53 Then its a template string Kaz Baig @kbaig Jan 26 2018 16:53 It's a template string Jason Luboff @JLuboff Jan 26 2018 16:53 Boom! Kaz Baig @kbaig Jan 26 2018 16:54 Nazar @IsaakNazar Jan 26 2018 16:54 ok @kbaig @JLuboff BOOM Thx :) CamperBot @camperbot Jan 26 2018 16:54 isaaknazar sends brownie points to @kbaig and @jluboff :sparkles: :thumbsup: :sparkles: :star2: 2308 | @jluboff |http://www.freecodecamp.org/jluboff :cookie: 558 | @kbaig |http://www.freecodecamp.org/kbaig Jason Luboff @JLuboff Jan 26 2018 16:56 @kbaig One time someone was working with vanilla JS... but they had $ throughout the code..and I was confused.. since it looked like they were using it like you would in jQuery but the rest of the code wasn't jQuery.. eventually I think someone pointed out that they had $as a variable for document.getElementByID or whatever it was. Interesting use I thought Blauelf @Blauelf Jan 26 2018 16:57 Could be combined with variable _ :D Kaz Baig @kbaig Jan 26 2018 16:57 Yeah some people like to set $ as document.querySelector
Blauelf
@Blauelf
Jan 26 2018 16:58
(_ is used by libraries underscore and lodash)
Jason Luboff
@JLuboff
Jan 26 2018 16:58
True
Blauelf
@Blauelf
Jan 26 2018 17:03
WTF? 〸 is a valid identifier? I thought $ and _ were the worst. Jason Luboff @JLuboff Jan 26 2018 17:04 ...How do you even create that character? lol Blauelf @Blauelf Jan 26 2018 17:04 BTW, that's Japanese/Chinese for "ten". let ε = -1; (mathematicians might get the joke) Jason Luboff @JLuboff Jan 26 2018 17:07 Calling @Masd925 Blauelf @Blauelf Jan 26 2018 17:08 Or use the totally different character 𝟄 (also an epsilon)? @JLuboff In maths, things often start with "let epsilon be greater than zero, then there exists a delta so that ...". In that sense, negative epsilon is creating a whole new kind of maths. Jason Luboff @JLuboff Jan 26 2018 17:11 @Blauelf You know...I used to think I was good at math...then I got to Calculus and I was in for a rude awakening :D Blauelf @Blauelf Jan 26 2018 17:12 Jason Luboff @JLuboff Jan 26 2018 17:14 @Blauelf Is that you in the orange shirt? ;) Blauelf @Blauelf Jan 26 2018 17:17 There are more nerds out there. Blauelf @Blauelf Jan 26 2018 17:24 ಠ_ಠ is a valid identifier. https://mothereff.in/js-variables Jason Luboff @JLuboff Jan 26 2018 17:25 I would hate to have to type that everytime lol Blauelf @Blauelf Jan 26 2018 17:29 When I started with Java, around 1998, I used special characters all the time. Then I realized that my code broke whenever I changed from Windows to Linux or the other way around, due to different encoding. Replacing all the special characters with their unicode sequence to fix that made it unreadable. aRtoo @artoodeeto Jan 26 2018 17:41 hey fam is there a site the i could get a link for a mp3 Blauelf @Blauelf Jan 26 2018 17:51 ? Markus Kiili @Masd925 Jan 26 2018 17:59 @JLuboff You called :imp: Jason Luboff @JLuboff Jan 26 2018 17:59 @Masd925 Ya... @Blauelf was making a math joke..figured you'd get it Markus Kiili @Masd925 Jan 26 2018 18:00 I have done math, but seemingly not enough... Jason Luboff @JLuboff Jan 26 2018 18:02 hmmm Blauelf @Blauelf Jan 26 2018 18:03 I mean something like $\forall \epsilon > 0, \exists \delta > 0 \ldots$, as used for example in Wikipedia: (ε, δ)-definition of limit Dan Lafferty @DanLaff Jan 26 2018 18:09 aRtoo @artoodeeto Jan 26 2018 18:10 @DanLaff thanks bro! CamperBot @camperbot Jan 26 2018 18:10 artoodeeto sends brownie points to @danlaff :sparkles: :thumbsup: :sparkles: api offline Dan Lafferty @DanLaff Jan 26 2018 18:10 You're welcome Blauelf @Blauelf Jan 26 2018 18:12 @DanLaff I'm impressed that you were able to interpret that request in any way. Are you trained in telepathy? :D Kelechi Chinaka @ke1echi Jan 26 2018 18:12 @Blauelf i spent a lot of time tryin to get cs50 offline ide, had lots of error and the files are too big, i think i wud stick to the online version..what do u think? Blauelf @Blauelf Jan 26 2018 18:14 Online IDE is an option for me, and offline IDE is some work, so I go with the online one. Dan Lafferty @DanLaff Jan 26 2018 18:15 @Blauelf I work with ESL students, but I'm guessing in a webdev forum when someone wants a link to a mp3, they want a sound or some music on their site Kelechi Chinaka @ke1echi Jan 26 2018 18:15 :+1: thanks @Blauelf CamperBot @camperbot Jan 26 2018 18:15 kelechy sends brownie points to @blauelf :sparkles: :thumbsup: :sparkles: :star2: 4679 | @blauelf |http://www.freecodecamp.org/blauelf aRtoo @artoodeeto Jan 26 2018 18:25 hey fam how to toggle button without toggle class? Jason Luboff @JLuboff Jan 26 2018 18:26 @artoodeeto add/remove the associated toggle class? aRtoo @artoodeeto Jan 26 2018 18:26 @JLuboff i have this btn bro strict.addEventListener('click', function(){ stricto = true; strict.style.background = '#57ED78'; if(stricto){ stricto = false; console.log(stricto); strict.style.background = 'red'; } }); @JLuboff i dont want to make a class that will change a background green. i just want to add a BG color if it has been clicked Jason Luboff @JLuboff Jan 26 2018 18:28 does strict allow for backgorund color? Kelechi Chinaka @ke1echi Jan 26 2018 18:29 i just needed somebody to tell am still sane if i used the online version..i have spent days meant for coding trying to understand docker errors while trying to install the offline tool @Blauelf aRtoo @artoodeeto Jan 26 2018 18:29 @artoodeeto if you mean it will change if i click it yea it will Jason Luboff @JLuboff Jan 26 2018 18:31 Ok..maybe I don't understand the issue then Blauelf @Blauelf Jan 26 2018 18:31 @artoodeeto Wouldn't this be more like  strict.addEventListener('click', function(){ var stricto = true; return function() { stricto = !stricto; if(stricto) { strict.style.background = '#57ED78'; } else { strict.style.background = 'red'; } }; }()); ? (assuming you want a variable stricto that's unique to the button) aRtoo @artoodeeto Jan 26 2018 18:33 @Blauelf let me try bor @Blauelf not working bro. yea stricto is only for strict btn Dan Lafferty @DanLaff Jan 26 2018 18:36 strict.addEventListener("click", function() { if(strict.style.background == "red") { strict.style.background = "#57ED78" } else { strict.style.background = "red" } }); Maybe that's simpler? Blauelf @Blauelf Jan 26 2018 18:37 I tried my code, and it does what I think it should do (toggle background colour). Ronique Ricketts @RoniqueRicketts Jan 26 2018 20:17 Hi guys I haven't been here much this year. Jason Luboff @JLuboff Jan 26 2018 20:21 :wave: Ronique Ricketts @RoniqueRicketts Jan 26 2018 20:23 So i am still stuck with setting up passoprt and session for my application. Jason Luboff @JLuboff Jan 26 2018 20:24 Whats not working Ronique Ricketts @RoniqueRicketts Jan 26 2018 20:25 @JLuboff still lost on session and passport. Do I set session in my mysql database connection file or on the actual route? Jason Luboff @JLuboff Jan 26 2018 20:31 @RoniqueRicketts Passport sets it.. Thats the purpose of the serialize and deserialize functions @RoniqueRicketts Are you trying to use local strategy or one of the oauth strategies? Ronique Ricketts @RoniqueRicketts Jan 26 2018 20:35 local strategy I want to use Jason Luboff @JLuboff Jan 26 2018 20:37 @RoniqueRicketts Take a look at my game trading app https://github.com/JLuboff/GameTrader specifically in the app.js file and the routes->routes.js file to get an idea (in the routes file I think all my routes having to do with passport are /login/* Ronique Ricketts @RoniqueRicketts Jan 26 2018 20:41 @JLuboff ok will check it @JLubof does it work the same if I am using mysql db? Jason Luboff @JLuboff Jan 26 2018 20:47 @RoniqueRicketts I don't see why it wouldn't besides your queries being different Ronique Ricketts @RoniqueRicketts Jan 26 2018 20:47 I've never configured it before so I have a lot of questions man :) Jason Luboff @JLuboff Jan 26 2018 20:48 No worries Ronique Ricketts @RoniqueRicketts Jan 26 2018 20:51 gonna try it and see if I can config mine @JLuboff look at my folder structure https://github.com/RoniqueRicketts/my-school-app/tree/master/school-app will I add the passport to the app.js file or on routes Jason Luboff @JLuboff Jan 26 2018 21:10 @RoniqueRicketts Assuming your app.js is your entry point, then in there Tiago Correia @tiagocorreiaalmeida Jan 26 2018 21:59 hey! Jason Luboff @JLuboff Jan 26 2018 21:59 Yo Tiago Correia @tiagocorreiaalmeida Jan 26 2018 22:00 all good? Jason Luboff @JLuboff Jan 26 2018 22:00 Ya I'd say so..you Tiago Correia @tiagocorreiaalmeida Jan 26 2018 22:01 all ok :D , need your help if you dont mind, getting a bit crazy with this api ended up looking on your old fcc project the gmae trader, im getting poor quality images for the games not sure if doing something worng Jason Luboff @JLuboff Jan 26 2018 22:02 If I remember right...I had to pull images from a different endpoint? Let me check my code Tiago Correia @tiagocorreiaalmeida Jan 26 2018 22:03 ok would be great if you could, thanks :D next lvl quality :D this are like 50px thumbnails I guess Jason Luboff @JLuboff Jan 26 2018 22:03 Ahhhhh now I remember what I had to do "https://images.igdb.com/igdb/image/upload/t_cover_big/${el .cover .cloudinary_id}.jpg"
So i didn't need a different endpoint for the request
but in displaying the image, I had to use that url above and stick my variable in there
Tiago Correia
@tiagocorreiaalmeida
Jan 26 2018 22:05
so you pick the images from a different place ok, what are the "cloudinary_id" variable?
Jason Luboff
@JLuboff
Jan 26 2018 22:06
Are you getting all fields from your request or just specific ones? I got specific ones
/games/?search=\${game.replace( /\s/g, '%20' )}&fields=id,name,summary,total_rating,developers.name,publishers.name,game_modes.name,cover,release_dates.platform,release_dates.human&expand=developers,publishers,game_modes&filter[release_dates.platform][eq]=48&filter[release_dates.platform][eq]=49&limit=5

Tiago Correia
@tiagocorreiaalmeida
Jan 26 2018 22:06
for now getting all since it runs quite faster and im using offset and limit not much to worry at the point
Jason Luboff
@JLuboff
Jan 26 2018 22:06
So I specified the cover field. which then has cloudinary_id as a property in it
what endpoint are you using for the request as well?
Tiago Correia
@tiagocorreiaalmeida
Jan 26 2018 22:06
makes sense :D
yeah tested out one looks alot better than what I had before
Jason Luboff
@JLuboff
Jan 26 2018 22:07
Yup, there you go. So just use that url I posted above
Tiago Correia
@tiagocorreiaalmeida
Jan 26 2018 22:07
im working with node/axios for the backend just the usual :D
how's c#? have you left the js life?
and thanks @JLuboff
CamperBot
@camperbot
Jan 26 2018 22:07
tiagocorreiaalmeida sends brownie points to @jluboff :sparkles: :thumbsup: :sparkles:
:star2: 2310 | @jluboff |http://www.freecodecamp.org/jluboff
Jason Luboff
@JLuboff
Jan 26 2018 22:08
The problem I had with the images after that is that they aren't all the same size but oh well I made it work lol
Tiago Correia
@tiagocorreiaalmeida
Jan 26 2018 22:08
im gonna use a defiend size and object-fit I guess this is just for pratice propuse :D
Jason Luboff
@JLuboff
Jan 26 2018 22:08
C# is good, passed my certification test a few weeks back and finished my first application today. Going to be building a web based application for work that will use node so haven't left js ;)
Tiago Correia
@tiagocorreiaalmeida
Jan 26 2018 22:10
nice :D another thing I found strange with this api 90% of the games lack cover image?
Jason Luboff
@JLuboff
Jan 26 2018 22:11
Mmmm...I stuck with PS4/XB1 games so I don't think I ran into that issue
Tiago Correia
@tiagocorreiaalmeida
Jan 26 2018 22:11
maybe im just searching really random names and that's the problem :D
Jason Luboff
@JLuboff
Jan 26 2018 22:13
Possibily. It is an odd API. Like why the hell do I need so many damn endpoints which then some can convert the returned numbers (i.e publishers is a number instead of a name) to an actual name and others cant.
Tiago Correia
@tiagocorreiaalmeida
Jan 26 2018 22:15
yeah noticed taht seems you are forced to expand the sections or something similiar I dont know tbh Didnt wasted alot of time in the documentation
Jason Luboff
@JLuboff
Jan 26 2018 22:15
Ah, ya expand thats the word
but you can't expand the same properties from one endpoint to another. Fucking stupid lol
aRtoo
@artoodeeto
Jan 26 2018 22:17
hey fam can you help me find bugs? i need to add one more animation if the user doesnt turn on strict if he gets wrong theres should be effect but i couldnt get a mp3 error to embed. but heres my pen. https://codepen.io/artoo/pen/opQZWy?editors=0010
CamperBot
@camperbot
Jan 26 2018 23:42
gusd773 sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 4674 | @masd925 |http://www.freecodecamp.org/masd925
jusgoose
@gusd773
Jan 26 2018 23:43
@Marmiz thank you I def learned about the && operator 4 years ago along with else if statements I really needed this to humble me lol
CamperBot
@camperbot
Jan 26 2018 23:43
gusd773 sends brownie points to @marmiz :sparkles: :thumbsup: :sparkles:
:star2: 1134 | @marmiz |http://www.freecodecamp.org/marmiz