These are chat archives for FreeCodeCamp/Help

18th
Sep 2018
psyperl
@psyperl
Sep 18 2018 00:03
also i can use then as a stub and the program would compile
new Promise(somePromise)
  /// TODO: get resource A
  .then()
  /// TODO: get resource B
  .then()
  /// TODO. get resource C
  .then()
i am starting to like Promises
and that code is so green....
Aditya
@ezioda004
Sep 18 2018 02:29
@Smootimus My uni wasnt registered with jetbrains so I had to make a PR to their swot repo, waiting for that to merge
Aditya
@ezioda004
Sep 18 2018 02:39
@psyperl I like async-await syntax on top of promises, makes it look synchronous and even more easier to read
async function someFunc(){
  let A = await new Promise(someProcess);
  let B = await new Promise(anotherProcess);
 //do some stuff with A and B
}
But in above example B waits until A is finished, its too synchronous, can be handled better with Promise.all()
async function someFunc(){
  let x = await Promise.all([new Promise(someProcess), new Promise(anotherProcess)]);
  //do stuff
}
This can fully utilize the event loop
Kyle Holm
@thekholm80
Sep 18 2018 02:42
:fire:
washing
@washing1127
Sep 18 2018 02:57
hi is there any Python leaner?
Hall
@channinghall
Sep 18 2018 04:53
I wonder where is wrong?

<link href="https://fonts.gdgdocs.org/css?family=Lobster" rel="stylesheet" type="text/css">

<style>
.red-text {
color: red;
}

p {
font-size: 16px;
font-family: Monospace;
}
</style>

<h2 class="red-text">CatPhotoApp</h2>

<p class="red-text">在大家心目中,猫是慵懒的可爱的化身,它可以睡饱了再起来吃饭,可以逗趣小耗子,可以卖得了萌,使得了坏,这样百变的小怪兽就集结在一只宠物上,怎能不惹人怜爱。</p>
<p class="red-text">养动物有的时候,就是介于爱与恨之间,当你钦羡别人萌宠这么可爱的时候,你一定没有想过,狗狗和猫猫会到处拉屎,甚至会屯老鼠,啃鞋子,用爪子爬门,你不理它,它就挠你,你要对它发脾气,它会比你更来劲。所以,狗猫慎入,没有一定的准备,切勿随便去侍养动物。它们一旦认定你了,你就是它们的主人,如果你抛弃它们,它们必定心中重创。</p>

错误提示:你的副标题应该使用字体Lobster
Claudio Restifo
@Marmiz
Sep 18 2018 05:50
@channinghall what is che challenge name?
Are you sure both p has to be red-text?
Hall
@channinghall
Sep 18 2018 06:37
I got it。thanks your kind help
Jake
@neozane1
Sep 18 2018 07:19
hello world
is using flexbox the best way to get a nav bar working correctly
Claudio Restifo
@Marmiz
Sep 18 2018 08:14

depends a lot on the specifics. Flexbox / Grid are of course preferred since widely supported.
But you can still do it in the old fashioned way.

Navbar existed before flexbox :)

Julian Zhu
@OrangeBorning
Sep 18 2018 09:33
Hi, i have a problem
delegate_blocked_by = “MojoAsyncResourceHandler"
I didn't find the right answer to this question on google.
My request was blocked by the browser
Chrome log points to this error
Somebody can help me
Hall
@channinghall
Sep 18 2018 09:33
;
maybe you lack ;
Julian Zhu
@OrangeBorning
Sep 18 2018 09:34
?
The problem is very strange, the request for the page is normal on all developers' computers. But it’s abnormal on the test and PM computer.
Lily
@smilemiley57
Sep 18 2018 09:43
求助:如何完成这个task? 任务:创建一个链接到http://freecatphotoapp.com的a元素,并用cat photos作为其anchor text(锚点文本)。
Dingbin
@tobeforgetten
Sep 18 2018 09:45
应该是这样吧
<a href="#http://freecatphotoapp.com">cat photos</a>
Lily
@smilemiley57
Sep 18 2018 09:46
这个是放在 img 那个tag里吗?
Dingbin
@tobeforgetten
Sep 18 2018 09:46
你把截图发出来
好像不是的是在<p>标签里的
这个是超链接呀
Lily
@smilemiley57
Sep 18 2018 09:51
@tobeforgetten ok 明白了 搞定了 谢谢你:)
Dingbin
@tobeforgetten
Sep 18 2018 09:52
没事我也是才开始学习能帮到你很荣幸
哈哈
你可以在中文频道问
Lily
@smilemiley57
Sep 18 2018 09:54
@tobeforgetten 我是这周才开始学的,感觉freecodecamp真的不错,让我很有兴趣,希望能够坚持下去!
Dingbin
@tobeforgetten
Sep 18 2018 09:54
@smilemiley57 加油!!
Hall
@channinghall
Sep 18 2018 10:14
请问中文频道在哪里呢
@smilemiley57 我也学到你这里嘿嘿,加油
Hall
@channinghall
Sep 18 2018 10:19
Make Dead Links using the Hash Symbol ,
where to add hash#?
how to do this?
dont understand...
Yago Estévez
@yagoestevez
Sep 18 2018 10:20
href="#"
Hall
@channinghall
Sep 18 2018 10:21
I got it, thanks
muchas gracias,guabo
Yago Estévez
@yagoestevez
Sep 18 2018 10:21
Lol
De nada
Dingbin
@tobeforgetten
Sep 18 2018 10:23
可以自己搜索一下Chinese
然后加入就可以啦
Hall
@channinghall
Sep 18 2018 10:25
谢谢已经加入,然后发现挺喜欢international way的
Dingbin
@tobeforgetten
Sep 18 2018 10:25
我是英语太菜了
Hall
@channinghall
Sep 18 2018 10:26
我英语专八
技术很菜
Dingbin
@tobeforgetten
Sep 18 2018 10:26
可以可以,刚过六级瑟瑟发抖
Hall
@channinghall
Sep 18 2018 10:27
彼此学习吧,互相促进彼此缺的地方
黄俊
@DYLANFREE
Sep 18 2018 10:32
有个问题,当我把label打成lable的时候,依旧有单选框出来,是系统自动帮我处理了吗?(提交是失败的,但是用<lable><input type="radio" name="indoor-outdoor"></lable>,仍然可以把单选按钮做出来)
May Kittens Devour Your Soul
@diomed
Sep 18 2018 10:35
@DYLANFREE label :ballot_box_with_check:
lable :x:
Hall
@channinghall
Sep 18 2018 10:35
I dont think you should waste time on this question. nonsense, just correct it . then go on learning
Nicolas Ramirez
@kamatheuska
Sep 18 2018 10:57

So, got a question, maybe a bit out of context, but since I am using Vue.js for the frontend, here it goes:

How can I make a user access my website only via a unique link, without the need for a proper authentication? This link should have an expiration date.

Maybe something like a token in the URL? 🤔🤔

psyperl
@psyperl
Sep 18 2018 12:02
OAuth?
Smootimus
@Smootimus
Sep 18 2018 12:22
@ezioda004 ah that's crummy
John
@taloloy18
Sep 18 2018 12:51
What website are you using when testing the task in free code camp about the JavaScript?
More convenient to use
May Kittens Devour Your Soul
@diomed
Sep 18 2018 13:09
@taloloy18 http://jsbin.com would be best choice for that
Aditya
@ezioda004
Sep 18 2018 13:20
repl.it is nice, and dev tools is good too
May Kittens Devour Your Soul
@diomed
Sep 18 2018 13:50

when we use
top:
bottom:

is that margin or smth else?

like some distance ...?...
John
@taloloy18
Sep 18 2018 13:51
tnx guys! XD
Aditya
@ezioda004
Sep 18 2018 13:54
@diomed Just top, bottom? Thats used to change position of the element
May Kittens Devour Your Soul
@diomed
Sep 18 2018 13:55
like top: 40px
Aditya
@ezioda004
Sep 18 2018 13:57
Yeah thats used to changed the position of the element, wont work on default (ie position: static;) unless you have position: absolute|relative|fixed
Kyle Holm
@thekholm80
Sep 18 2018 14:58
good morning, /help
May Kittens Devour Your Soul
@diomed
Sep 18 2018 14:58
good morning, Kyle
Kyle Holm
@thekholm80
Sep 18 2018 15:00
@diomed x
May Kittens Devour Your Soul
@diomed
Sep 18 2018 15:03
oh wow, KO
@thekholm80 I wonder what would he say to those who mistake in sugar
Kyle Holm
@thekholm80
Sep 18 2018 15:05
lol the look on her face is awesome
Aditya
@ezioda004
Sep 18 2018 15:09
Took me a while to realize its not "motivational"
Kyle Holm
@thekholm80
Sep 18 2018 15:12
lol
May Kittens Devour Your Soul
@diomed
Sep 18 2018 15:14
it's more r/watchpeopledieinside stuff
Kyle Holm
@thekholm80
Sep 18 2018 15:15
one of my favorite subs
May Kittens Devour Your Soul
@diomed
Sep 18 2018 15:28
@thekholm80 If you ever wondered r/somnivexillology
Kyle Holm
@thekholm80
Sep 18 2018 15:29
wait, there are people who think it's fun to create flags?
oh, from dreams
May Kittens Devour Your Soul
@diomed
Sep 18 2018 15:29
yup
Kyle Holm
@thekholm80
Sep 18 2018 15:29
i guess i have seen everything now
May Kittens Devour Your Soul
@diomed
Sep 18 2018 15:30
of all the things I never knew they existed that surely is one
Xarri Jorge
@xarrijorge
Sep 18 2018 15:42
You've never seen the Big Bang Theory then? @diomed
Vexillology is one of Dr. Cooper's hobbies.
glitz20
@glitz20
Sep 18 2018 16:13
Hey guys I am trying to get admin page only when admin is logged in
  <Switch>
                <Route exact path="/" component={Home} />
                <Route path="/login" render={() => <LoginForm updateUser={this.updateUser}/>}/>
                <Route path="/signup" render={() => <Signup />} />
                {[
                    this.state.username == 'admin' && (<Route path='/admin' render={() => <Admin />} />),
                    !this.state.username == 'admin' && (<Route path='/admin' render={() => <Error />} />)
                 ]}
            </Switch>
I have state for username, and I am doing this right now, but its not working. Any suggestions?
Henry
@GitHub-Henry
Sep 18 2018 16:53
May Kittens Devour Your Soul
@diomed
Sep 18 2018 17:00
@xarrijorge this is somnivexillology - which means flags in dreams
it's basically deeper :shit: of insanity
Niraj Nandish
@Nirajn2311
Sep 18 2018 17:32
Has anyone updated to iOS 12
May Kittens Devour Your Soul
@diomed
Sep 18 2018 17:35
these guys did: https://redd.it/9gmle9 @Nirajn2311
Niraj Nandish
@Nirajn2311
Sep 18 2018 17:36
It is 🔥🔥🔥
@diomed I’ll look at your css problem in the weekend, as I don’t have time until then
May Kittens Devour Your Soul
@diomed
Sep 18 2018 17:38
how rude
xD
Niraj Nandish
@Nirajn2311
Sep 18 2018 17:42
😂😂
Yeah School is rude to us
jpjenkins
@jpjenkins
Sep 18 2018 18:09
Not so much happening no the LetsPair page
I’m on the ‘arguments optional’ challenge from intermediate algorithm scripting, anyone want to pair? This currying business is crushing me
Eric Weiss
@eweiss17
Sep 18 2018 18:11
can you link the challenge?
I usually refuse to click ‘get a hint’ until I’ve finished it myself, even if it takes days. I’m still refusing, but no doubt I feel I’m missing something that I don’t know I don’t know
Eric Weiss
@eweiss17
Sep 18 2018 18:25
hmm you can knock out most of the use cases from the get go
the return function is probably the only one that will have to take some considering
what have u got so far
jpjenkins
@jpjenkins
Sep 18 2018 18:26
Well I’ve been working on it for a while now so I’ve got a tonne of random stuff commented out, but here’s what I’m working with at the moment, not completely factored:
if(arguments.length > 1) {
    return arguments[0]+arguments[1];
  } else if (typeof x !== Number) {
    return undefined
  } else {

  return function(y) {
    if(typeof y !== Number){
      return undefined
    }
  }
  }
I feel like there should be a simpler way to do this through recursion, I figured there would be a way to check to see if there is a chained function in the original function call. Although I sense that a recursion might also just be too much
and my return there doesn’t seem to do anything at the moment, the last argument that has an array as the second function call isn’t returning undefined and I’m not sure why
Eric Weiss
@eweiss17
Sep 18 2018 18:31
well let's see
(2, "3") should return undefined
so it goes into first if statement
and returns arguments[0] + arguments[1] , which is 5
so you need to check if the inputs are numbers first
my bad i edited the previous
just do one case at a time, and you will finish it
jpjenkins
@jpjenkins
Sep 18 2018 18:35
okay, I thought there may be something I’m missing, since most of these thigns can be finished if I just mashed out some conditionals. Do you think that’s just what’s required here? With a little bit of a lesson on currying
Eric Weiss
@eweiss17
Sep 18 2018 18:36
not sure, unless somebody has just recently done it or uses a function like this often
the best help is me just assuming what you are doing is correct
and going from there
before coding
try writing down everything that needs to happen
and then evaluate how to translate what you wrote down into code
jpjenkins
@jpjenkins
Sep 18 2018 18:45
@eweiss17 thanks for your time Eric, pen and paper is still the wise choice in this day and age :)
Karma Drukpa
@coderkarma
Sep 18 2018 20:46
any good resources to look up to make background image change over time smoothly.
Kyle Holm
@thekholm80
Sep 18 2018 21:18
@coderkarma you mean on a timer, or in response to some user action?
May Kittens Devour Your Soul
@diomed
Sep 18 2018 21:22
@coderkarma slideshow
like that
@thekholm80 yes in set interval where it should change background images frequently.
May Kittens Devour Your Soul
@diomed
Sep 18 2018 21:26
so what?s the problem?
why not use that1?
Kyle Holm
@thekholm80
Sep 18 2018 21:27
very good question
May Kittens Devour Your Soul
@diomed
Sep 18 2018 21:37
I think that you can take any carousel and set it to autoplay
Karma Drukpa
@coderkarma
Sep 18 2018 21:39
@thekholm80 is there any ways where we could write function and target images to set intervals.
Kyle Holm
@thekholm80
Sep 18 2018 21:39
yep
anything you've seen done, can be done
and pretty much anything you can think of as well
Karma Drukpa
@coderkarma
Sep 18 2018 21:40
I have never done it before, so bit hesitated.
@thekholm80 okay
lol
Kyle Holm
@thekholm80
Sep 18 2018 21:41
the simplest would be to get a reference to an element, like document.getElementById('yourElement'); then use setInterval() to change the element
you could have an array of images and loop through those
or, go with something pre-built like jquery has
or, ask @diomed to make it for you
May Kittens Devour Your Soul
@diomed
Sep 18 2018 21:42
hue hue hue
Kyle Holm
@thekholm80
Sep 18 2018 21:43
if i ever get a dev job i'm just going to hire @diomed to do all my work
diomed @diomed delivers only in vue
May Kittens Devour Your Soul
@diomed
Sep 18 2018 21:45
:yum:
Karma Drukpa
@coderkarma
Sep 18 2018 21:45

let  images = ["images/beach.jpg", "images/haven.jpg", "images/newimage"];

function getRandomInt() {

  return Math.floor(Math.random() * images.length);
}

function nextBackground(){
  $("body").css("background-image", "url(" + images[getRandomInt()] + ")");
}
setInterval(nextBackground, 1250);
May Kittens Devour Your Soul
@diomed
Sep 18 2018 21:47
@coderkarma u gonna release pure JS version of script?
Karma Drukpa
@coderkarma
Sep 18 2018 21:47
@diomed that's not me.
lol
was googling found out that and tried. it works but transition is not smooth
@thekholm80 could you show me jquery stuff
Kyle Holm
@thekholm80
Sep 18 2018 21:49
nope
i quit cold turkey months ago and i'm not going back
Karma Drukpa
@coderkarma
Sep 18 2018 21:49
lol
okay
May Kittens Devour Your Soul
@diomed
Sep 18 2018 21:49
@coderkarma what do you want it in?
Karma Drukpa
@coderkarma
Sep 18 2018 21:49
i will google then
Kyle Holm
@thekholm80
Sep 18 2018 21:49
i can help you in vanilla js though lol
May Kittens Devour Your Soul
@diomed
Sep 18 2018 21:50
damnit I always forget JS is called by favorite ice-cream flavor
Karma Drukpa
@coderkarma
Sep 18 2018 21:50
yes, that would be perfect. @thekholm80
Kyle Holm
@thekholm80
Sep 18 2018 21:50
lemme fire up a repl.it
Karma Drukpa
@coderkarma
Sep 18 2018 21:51
@diomed buymecoffee
May Kittens Devour Your Soul
@diomed
Sep 18 2018 21:51
fadeIn effect
Karma Drukpa
@coderkarma
Sep 18 2018 21:51
@thekholm80 thnaks
May Kittens Devour Your Soul
@diomed
Sep 18 2018 21:51
@coderkarma no, u buy me a :coffee:
thnaks @thekholm80 , your teh bestest
welp, ok . gotta go sleep. bye humans
:cat:
Kyle Holm
@thekholm80
Sep 18 2018 21:53
g'night
Karma Drukpa
@coderkarma
Sep 18 2018 21:53
@diomed Don't sleep now. it is just 3pm
bye humans @diomed ?
Kyle Holm
@thekholm80
Sep 18 2018 21:58
@coderkarma this will do it randomly like your jquery code
i dislike the random though
it often picks the same image over and over
Karma Drukpa
@coderkarma
Sep 18 2018 22:18
@thekholm80 thanks.
@thekholm80 so make transition smooth, do i need to make changes in css?
Kyle Holm
@thekholm80
Sep 18 2018 22:26
that's probably the easiest
Karma Drukpa
@coderkarma
Sep 18 2018 22:38
@thekholm80 thank you. But now I have a problem with background image, actually I put my background image inside body doing like this
body {
    background-image: url("/images/beach.jpg");  
    width: 100%;
    height: auto;
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center center;
    transition: 3s; 
    background-blend-mode: darken;

}
Kyle Holm
@thekholm80
Sep 18 2018 22:39
you know that body is an element, right?
Karma Drukpa
@coderkarma
Sep 18 2018 22:42
yes
Kyle Holm
@thekholm80
Sep 18 2018 22:43
err
i guess i've failed to figure out what your problem is
maybe just tell me
Karma Drukpa
@coderkarma
Sep 18 2018 22:53
@thekholm80 I want those images show in my background like this
Kyle Holm
@thekholm80
Sep 18 2018 22:53
k
so remember that example i made for you?
instead of image, get a reference for body
instead of src, change the css attribute
Kyle Holm
@thekholm80
Sep 18 2018 22:58
for this i'd probably use document.querySelector('body') to get the element
Karma Drukpa
@coderkarma
Sep 18 2018 23:00
ok. I will try with this. document.querySelector('body')
cause it wasn't working with other.
const img = document.querySelector("body");
const urls = ["images/beach.jpg", "images/haven.jpg"];

function getRandom() {
     return Math.floor(Math.random() * urls.length);
 }

 function changeImage() {
    img.body = urls[getRandom()];
 }

 setInterval(changeImage, 2000);
trying this
Kyle Holm
@thekholm80
Sep 18 2018 23:05
and to change css in vanilla js you just call the property off of the element's style attribute. so if i wanted to change an element's background-color to black i'd do:
const myElement = document.querySelector(/* whatever element you're after */);
myElement.style['background-color'] = 'black'; // using bracket notation because this css property has a hyphen
// otherwise i could just
myElement.style.height = 400;
Bjorn van de Peut
@bjorno43
Sep 18 2018 23:08
myElement.style.backgroundColor would work just fine
Kyle Holm
@thekholm80
Sep 18 2018 23:08
nobody likes a know-it-all, bob
Bjorn van de Peut
@bjorno43
Sep 18 2018 23:08
:joy:
Karma Drukpa
@coderkarma
Sep 18 2018 23:08
bob