These are chat archives for FreeCodeCamp/Help

27th
Sep 2018
ReesesLover123
@ReesesLover123
Sep 27 2018 01:26
Do we have a CSS room?
Kyle Holm
@thekholm80
Sep 27 2018 01:33
@ReesesLover123 this room, or possibly the front end room
learningjs42
@learningjs42
Sep 27 2018 01:59
hello all can someone make this callback code in code with promises because im trying to learn promises thanks in advance :)
function first(callback,age){
console.log("hello how are you and how old")

setTimeout(callback,5000,age);
}

function dyon(a){
    console.log(`hello my name is dyon and im ${a} years old` )
}

function natas(a){
    console.log(`hello my name is nATASJA and im ${a} years old` )
}

first(dyon,29);
//output my age is 29
//and my name is dyon

first(natas,39);
//output my age is 39
//and my name is natasja
learningjs42
@learningjs42
Sep 27 2018 02:11
anyone ?
@thekholm80 can you please help me with this if you are still online ?
i now got this but i think this is not the way
function test(a,b){
  const p = new Promise((resolve, reject) => {
    console.log("hello how are you and how old")
    setTimeout(() => {
     resolve(`hello my name is ${a}and im ${b} years old`);
    }, 1000);
  });

  p
    .then(data => {
      console.log(data);
    })
    .catch(err => {
      console.error(err);
    });
}

test("dyon",29)
Kyle Holm
@thekholm80
Sep 27 2018 02:27
@learningjs42 i'm guessing you're just trying to learn promises, not actually use this code for something?
a simple example would be
function someAsyncTask() {
  return new Promise((resolve, reject) => {
    if (whatEverCriteriaYouAreLookingFor) {
      resolve(value);
    } else {
      reject(reason);
    }
}

someAsyncTask().then(callback).catch(error => console.log(error));
Leena
@leena-d
Sep 27 2018 02:53
wait is promise actually a thing? cuz for me i'm using it as an id for an html element. no js involved
Kyle Holm
@thekholm80
Sep 27 2018 02:53
in javascript it's a thing
Leena
@leena-d
Sep 27 2018 02:53
i'm doing the product landing page project
and you just taught me something totally new
Kyle Holm
@thekholm80
Sep 27 2018 02:54
it's a great way for handling asynchronous tasks
Claudio Restifo
@Marmiz
Sep 27 2018 02:57

Do we have a CSS room?

the trash bin now has a name? :laughing:

ILY CSS :heart:
Kyle Holm
@thekholm80
Sep 27 2018 02:57
uh oh shots fired
Claudio Restifo
@Marmiz
Sep 27 2018 03:00
Actually since I started ditching css lib, making front end stuff has been more enjoyable lately
Kyle Holm
@thekholm80
Sep 27 2018 03:00
i don't mind css in stuff i make for my own use, but writing for every browser makes me very unhappy
Claudio Restifo
@Marmiz
Sep 27 2018 03:01
@thekholm80 you mean you manually vendor prefix it?
learningjs42
@learningjs42
Sep 27 2018 03:01
@thekholm80 thanks no its really just for learning :) but i try to learn the diffrences between calback and promises so i really eed this code in promises so i can see the difrence
function first(callback,age){
console.log("hello how are you and how old")

setTimeout(callback,5000,age);
}

function dyon(a){
    console.log(`hello my name is dyon and im ${a} years old` )
}

function natas(a){
    console.log(`hello my name is nATASJA and im ${a} years old` )
}

first(dyon,29);
//output my age is 29
//and my name is dyon

first(natas,39);
//output my age is 39
//and my name is natasja
Claudio Restifo
@Marmiz
Sep 27 2018 03:08

@learningjs42 a callback function is just a fancy term to name a function you pass as argument to a function, that is invoked after something happen.

Imagine

function addAndCb (x,y, cb) {
  let result = x + y;
  return cb(result);
}


function logToUser(n) {
  console.log(`your result is ${n}`)
}

addAndCb(3,6, logToUser) // your result is 9
It's an easy way to write more "composable" functions. Since if I want to change the behaviour I just need to pass a different callback.
psyperl
@psyperl
Sep 27 2018 03:12
and Promise have a function structure that takes 2 callbacks for success and for an error
psyperl
@psyperl
Sep 27 2018 03:18
const callMeIWillCallYouBack = (msg, yourCallBack) => {
  console.log(msg)
  yourCallBack("thanks for calling")
}
const letMeKnowIfIGotCalledBack = msg => {
  console.log("Got called back with message:")
  console.log(msg)
}
callMeIWillCallYouBack("hi there", letMeKnowIfIGotCalledBack)
:smile:
Kyle Holm
@thekholm80
Sep 27 2018 03:18
@psyperl is a promise expert
psyperl
@psyperl
Sep 27 2018 03:19
lol right, i just learn it for about a week
i am a promise enthusiast :smile:
Claudio Restifo
@Marmiz
Sep 27 2018 03:22

I got promises after I saw a wonderful example involving a promise of a cake if the user eats the vegetables ^^

I was like.... ooooh! now it make sense

Kyle Holm
@thekholm80
Sep 27 2018 03:23
using food as a reward for eating seems like a recipe for obesity
Karma Drukpa
@coderkarma
Sep 27 2018 03:23
@thekholm80
just need some few hints
I haven't solved it yet
Kyle Holm
@thekholm80
Sep 27 2018 03:24
@coderkarma it was the butler, in the kitchen with a rolling pin
Karma Drukpa
@coderkarma
Sep 27 2018 03:24
I was just pseudo coding for this problem
lol
Claudio Restifo
@Marmiz
Sep 27 2018 03:25
you really fancy those challenges @coderkarma :)
Kyle Holm
@thekholm80
Sep 27 2018 03:28
@coderkarma i'm trying to sort something else out right now
sorry
Karma Drukpa
@coderkarma
Sep 27 2018 03:28
It's ok sir @thekholm80
@Marmiz another champ is here
@Marmiz , trying to loop through arr2 and check to see if the arr1 element is in the arr2 or not, if it is then i will return arr1 element
@Marmiz guess i need to copy array2, since we cannot mutate original input
Claudio Restifo
@Marmiz
Sep 27 2018 03:31
@coderkarma index of?
Karma Drukpa
@coderkarma
Sep 27 2018 03:32
@Marmiz yes I will do index of.
Hall
@channinghall
Sep 27 2018 03:33
function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
  // 请把你的代码写在这条注释以下
  var result = "myNoun" + "myVerb" + "myAdjective" + "myAdverb" ;

  // 请把你的代码写在这条注释以上
  return result;
}

// 修改单词来测试函数
wordBlanks("dog", "big", "ran", "quickly");
result:
// running test
wordBlanks("dog", "big", "ran", "quickly")应包含由非单词字符(以及 madlib 中的其他单词)分隔的所有传入的单词。
wordBlanks("cat", "little", "hit", "slowly")应包含由非单词字符(以及 madlib 中的其他单词)分隔的所有传入的单词。
// tests completed
where's Wrong?plz
Karma Drukpa
@coderkarma
Sep 27 2018 03:38
@Marmiz I am not getting the rightput
Hall
@channinghall
Sep 27 2018 03:43
no one tell this...in Chinese area
psyperl
@psyperl
Sep 27 2018 03:43
const checkValue = (elem, array2) => 
  array2
    .filter(e => e.includes(elem)).length
const inArray = (array1,array2) => 
  array1
    .filter(e => checkValue(e,array2) ).sort()
Kyle Holm
@thekholm80
Sep 27 2018 03:44
@marmiz do you know a simple way to offset scroll when using ids to navigate on page? like if you have a fixed header, how to offset by the height of the header? surely there's a simpler way than to monkey-patch the click handler on the links
psyperl
@psyperl
Sep 27 2018 03:46
@channinghall
function test( someStr ) {
  console.log(someStr) // will print "hello"
  console.log("someStr") // will print "someStr"
}
test("hello")
Hall
@channinghall
Sep 27 2018 03:47
thanks,bro
Kyle Holm
@thekholm80
Sep 27 2018 03:53
oh that's so much better
psyperl
@psyperl
Sep 27 2018 03:53
i didn't test it .. not sure if it works or not
Kyle Holm
@thekholm80
Sep 27 2018 03:54
i'm over here trying to deal with HTMLCollections not being iterable and all that lol. i should probably learn some css
psyperl
@psyperl
Sep 27 2018 03:54
[...yourNotIterableHTMLCollection].map( console.log )
Henry
@GitHub-Henry
Sep 27 2018 03:57
Array.from(htmlCollection, item => (item.classList.add('x'))
psyperl
@psyperl
Sep 27 2018 03:57
^ works too :smile:
Henry
@GitHub-Henry
Sep 27 2018 03:57
getElement* returns HTML collection
querySelector* returns node list with forEach
Kyle Holm
@thekholm80
Sep 27 2018 03:58
now explain all of that to someone who doesn't know js
Henry
@GitHub-Henry
Sep 27 2018 03:59
have them use querySelector, then have them use forEach that is returned with the nodeList which has forEach
two step process
psyperl
@psyperl
Sep 27 2018 04:00
yeah spread operator is much easier i think .. and shorter
Kyle Holm
@thekholm80
Sep 27 2018 04:01
lol
psyperl
@psyperl
Sep 27 2018 04:01
it'll turn it to array with only an extra 5 chars :D
Kyle Holm
@thekholm80
Sep 27 2018 04:01
i don't think you remember what it was like when you first started learning js
but i got what i need, thanks
psyperl
@psyperl
Sep 27 2018 04:01
hehe
Henry
@GitHub-Henry
Sep 27 2018 04:02
JS easy to learn, difficult to master
psyperl
@psyperl
Sep 27 2018 04:04
i started learning ES6 last year here on fcc .. found many of their fancy stuff .. i like it
Aditya
@ezioda004
Sep 27 2018 04:57
@psyperl Thanks for saving characters, I'll spend it for you :DArray.prototype.map.call(yourNotIterableHTMLCollection, cb)
psyperl
@psyperl
Sep 27 2018 04:58
:smile:
alpox
@alpox
Sep 27 2018 06:22
Ehm.... FCC does something very weird in their editor with infinite loop protection o.O
alpox
@alpox
Sep 27 2018 06:30
Code passes which should really not pass due to an infinite loop
Ruben Dario
@rubendmatos1985
Sep 27 2018 07:06
@ezioda004 Hello. Yesterday you helped me with my project and we were talking about "onKeyPress" and "addEventListener("click")", and i wanted to tell you that i found something, that i really did not know. The difference between them it is pretty big and making the drum machine i could realized that "onKeyPress" it works but the event will start to listen when the element wich has these listener it is activated, and addEventListener will always listen for the global document. I wanted to share that with you because i would like that you tell me if it is correct my appreciation. I the case of the drum machine i need a global listener, since the begining. Thanks for your help. Yesterday was so productive
@ezioda004 sorry i made a mistake, i ment "onKeyPress" and addEventListener("keypress")
Aditya
@ezioda004
Sep 27 2018 07:15
@rubendmatos1985 Can you elaborate "addEventListener will always listen for the global document"? React synthetic events are same as addEventListener, its just a crossbrowser wrapper which makes sure the event behavior is same across all browsers.
Ruben Dario
@rubendmatos1985
Sep 27 2018 07:16
@ezioda004 I tried yesterday onKeyPress and the behavior was not like i wanted
i musted to click first the button and then it has began to listen
with "document.addEventListener" i had the beahavior that i want it
i give you the link
the keys are "q,w,e,a,s,d,z,x,c"
ahh by the way. I followed the logic you gave to make the buttons with map
that was perfect
i am trying to make everything in javascript and react without any other framework because i want to learn everything i can about javascript vanila
and css of course
Aditya
@ezioda004
Sep 27 2018 07:22
@rubendmatos1985 Ahh I see, so you wanted an event on the document object? Yeah that's different than the event on the element itself
Ruben Dario
@rubendmatos1985
Sep 27 2018 07:23
yes
that is what i mean
i want that the button listen since the begining
like a real drum machine
it was a hard work yesterday because i was 3 hours asking me my self the difference between this to listener, and now i know
yes it left just to make the css and the drum machine it is done
thank you a lot
Aditya
@ezioda004
Sep 27 2018 07:26
Yeah then you'll have to use .addEventListener, and yeah React is all JS, you may find some people using stuff which isnt standardized in JS yet but aside from that its all vanilla JS
No problem :smile:
Ruben Dario
@rubendmatos1985
Sep 27 2018 07:27
@ezioda004 and what do you think about the treatment i gave to states. It is correct??
@ezioda004 i tried to have just one state without redux and any other library
Aditya
@ezioda004
Sep 27 2018 07:31
@rubendmatos1985 Yeah state looks fine, your app isnt complicated enough so using Redux here would be an overkill :D
Ruben Dario
@rubendmatos1985
Sep 27 2018 07:33
@ezioda004 that will be my next challenge. Learn Redux. I think that this part in FCC it is a bit overwhelming you know??. To many libraries
at once
Aditya
@ezioda004
Sep 27 2018 07:36
Yes, I can see how it can be overwhelming. In previous curriculum, they had like 5 projects you had to make with vanilla JS, without any library, after that they had React projects. I think that was a good approach
Ruben Dario
@rubendmatos1985
Sep 27 2018 07:37
@ezioda004 yes i think the same, but just a las question, there is something new in react, and the people are saying it will be the end of redux, do you kow something about it?
Aditya
@ezioda004
Sep 27 2018 07:40
@rubendmatos1985 Context API? Its not "redux killer" but it certainly makes state management easier with just React. Redux wont die since its framework agnostic, you could use it with any library as well as vanilla JS
Ruben Dario
@rubendmatos1985
Sep 27 2018 07:41
@ezioda004 ok i will read more about it. I am a Vanilla Js fan!! :), greetins, and thanks for the help
Aditya
@ezioda004
Sep 27 2018 07:41
Happy coding!
psyperl
@psyperl
Sep 27 2018 08:34

React synthetic events are same as addEventListener, its just a crossbrowser wrapper which makes sure the event behavior is same across all browsers.

which browser that wouldn't work or behave differently with addEventListener?

let me guess.. IE? hehehe
yeah IE8 and earlier it seems
Eunice Park
@eunicode
Sep 27 2018 08:39

Hello everyone. I have a question about GitHub Pages and how to host files there(?).

So I have a data.json file, and I fetch that data with the Fetch API and do stuff with it. It works fine on my local web server (localhost:3000), but when I deploy my site on GitHub Pages, I get this error message in the console: Failed to load resource: the server responded with a status of 404 ()
And indeed, when I visit https://username.github.io/data/data.json, it says "404 There isn't a GitHub Pages site here."

So what's happening, and how do I resolve this? I have a feeling my problem has something to do with routing but that's something I'm not familiar with.

Edit: Just to be clear, my site was successfully deployed on GitHub Pages; it's just the AJAX/data fetching that's not working.

Hall
@channinghall
Sep 27 2018 08:43
is Quora can solve this?
May Kittens Devour Your Soul
@diomed
Sep 27 2018 08:44
@eunicode where is your site located? gimme link
@eunicode what file is this exactly?
@eunicode and do you have tech-doc in the link when u call it?
coz above u don't
Eunice Park
@eunicode
Sep 27 2018 08:48
That's true. I was wondering though, is there a way I can do this with relative paths?
May Kittens Devour Your Soul
@diomed
Sep 27 2018 08:48
https://raw.githubusercontent.com/eunicode/tech-doc/master/src/data/data.json
Eunice Park
@eunicode
Sep 27 2018 08:50
Thank you very much, but do you know how to accomplish this without absolute URLs?
May Kittens Devour Your Soul
@diomed
Sep 27 2018 08:50
no
maybe someone else knows
May Kittens Devour Your Soul
@diomed
Sep 27 2018 08:56
god bless Mozilla Firefox and her display of .json files
Aditya
@ezioda004
Sep 27 2018 08:59
Eunice Park
@eunicode
Sep 27 2018 09:00
@psyperl Yes, I was going to update my status and say that adding "tech-doc" to every url fixed my problem, like diomed suggested. But it's a pain fixing every url, and I think I remember reading somewhere that there's a way to handle this. I will look into it :)
abraham anak agung
@padunk
Sep 27 2018 09:21
what is Docker?
Hall
@channinghall
Sep 27 2018 09:30
psyperl is a real nice person....
abraham anak agung
@padunk
Sep 27 2018 09:46
@JohnnyBizzel Thanks mate :thumbsup:
Johnny
@JohnnyBizzel
Sep 27 2018 09:48
@padunk :+1:
Thayyeb salim
@Thayyebsalim
Sep 27 2018 10:55
Hi
I'm working on this calculator project, there's a huge part of repeating code. I can't seem to wrap my head over how to make a function out of it.
petrockwd
@petrockwd
Sep 27 2018 10:58
@Thayyebsalim What part of FCC syllabus are you on?
Thayyeb salim
@Thayyebsalim
Sep 27 2018 10:59
if (/\d/.test(exp[exp.length - 1])) {
      curOp = $(this).text();
if (op !== "") {
        switch (op) {
          case "+":
            acc += parseFloat(val);
            break;
          case "x":
            acc *= parseFloat(val);
            break;
          case "-":
            acc -= parseFloat(val);
            break;
          case "/":
            acc /= parseFloat(val);
            break;
          case "=":
            op = "";
            break;
        }
      } else {
        acc += parseFloat(val);
      }
}
      exp += curOp;
I want to make a this a function if possible because i have to repeat this whole chunk of code otherwise.
@petrockwd Frontend Libraries project
petrockwd
@petrockwd
Sep 27 2018 11:01
Are all the projects done in codepen?
Thayyeb salim
@Thayyebsalim
Sep 27 2018 11:02
Yeah
some in another id though
petrockwd
@petrockwd
Sep 27 2018 11:03
FCC use git?
Thayyeb salim
@Thayyebsalim
Sep 27 2018 11:03
?
petrockwd
@petrockwd
Sep 27 2018 11:05
Do you utilize git and github in FCC?
freecodecamp
Thayyeb salim
@Thayyebsalim
Sep 27 2018 11:05
I've linked it but havent copied the projects in or anything
atleast not the newer ones
petrockwd
@petrockwd
Sep 27 2018 11:06
Cool just wondering :-) I'm on the first projects section and need to open a codepen account
doing the odin project simultaenously
Eunice Park
@eunicode
Sep 27 2018 11:08

Just another update in case anyone else runs into this issue.
I was wrong, relative paths work fine in GitHub Pages.
But the fetch method requires direct URLs bc it's an HTTP request. So when you do fetch('/file.ext'), the browser will append your domain to it. That's why when I did fetch('../folder/file.ext'), the request was username.github.io/folder/file.ext, not username.github.io/REPO/folder/file.ext, which led to 404 errors. I think anyways(?).

Anyways, I was able to avoid putting "repoName" in my path by using a root relative path, which is different from a file relative path. A root relative path is relative to your project root, while a file relative path will be relative to the file you're currently in.
If you use a root relative path, you can use the same path as when you're developing locally as when your domain is username.github.io/REPO. So the root relative path /random.json will equal both localhost:3000/random.json and username.github.io/REPO/random.json. Whew, there's still a lot I'm iffy about so if anyone can add in any more info, that would be appreciated!

Thayyeb salim
@Thayyebsalim
Sep 27 2018 11:09
nice! @petrockwd
Aditya
@ezioda004
Sep 27 2018 11:15
@Thayyebsalim Is this code in the callback function of an operator's event listener?
Ujuuuuu!!!!11
Drum Machine finished!!
petrockwd
@petrockwd
Sep 27 2018 11:24
It says 4/8 tests
Ruben Dario
@rubendmatos1985
Sep 27 2018 11:24
@petrockwd yes but i made all what they told in the challenge
it has not to do
it is a drum machine and it works
petrockwd
@petrockwd
Sep 27 2018 11:25
Okay fair enough
Ruben Dario
@rubendmatos1985
Sep 27 2018 11:27
@petrockwd i made it quite responsive and with all the parameters they puted in the challenge
the problem is that they said an audio tag and i used the function new Audio from js
@petrockwd and the other problem i think is that i used .map to make the buttons and at the begining you can see that the bundle.js wrtite 7 and then write 3
it is a little bit crazy
Thayyeb salim
@Thayyebsalim
Sep 27 2018 11:42
@ezioda004 yes
$(".op").on("click", function() {
    if (exp === "") return;
    //repetition
    if (/\d/.test(exp[exp.length - 1])) {
      curOp = $(this).text();
      if (op !== "") {
        switch (op) {
          case "+":
            acc += parseFloat(val);
            break;
          case "x":
            acc *= parseFloat(val);
            break;
          case "-":
            acc -= parseFloat(val);
            break;
          case "/":
            acc /= parseFloat(val);
            break;
          case "=":
            op = "";
            break;
        }
      } else {
        acc += parseFloat(val);
      }
      exp += curOp;
    }//repetition
    if (curOp !== "-") val = "";
    op = curOp;
    append();
  });
Aditya
@ezioda004
Sep 27 2018 11:44
@Thayyebsalim So why not use this callback function for all the operators? Also, where's op coming from?
Thayyeb salim
@Thayyebsalim
Sep 27 2018 11:47
op is class name i use for the operation buttons
could you please check the code for me in the pen.It would be a huge favor
@ezioda004
Aditya
@ezioda004
Sep 27 2018 12:07
@Thayyebsalim You can make a function like this
function operation(){
    if (/\d/.test(exp[exp.length - 1])) {
      curOp = $(this).text();
      console.log(curOp)
      if (op !== "") {
        switch (op) {
          case "+":
            acc += parseFloat(val);
            break;
          case "x":
            acc *= parseFloat(val);
            break;
          case "-":
            acc -= parseFloat(val);
            break;
          case "/":
            acc /= parseFloat(val);
            break;
          case "=":
            op = "";
            break;
        }
      } else {
        acc += parseFloat(val);
      }
      exp += curOp;
    }
  }
And call this function like operation.call(this); because this changes to window object due to default binding, so preserve context of this we use .call()
I guess it works, heres the forked pen
learningjs42
@learningjs42
Sep 27 2018 12:31
can anyone help write this code with promises ?
function first(callback,age){
console.log("hello how are you and how old")

setTimeout(callback,5000,age);
}

function dyon(a){
    console.log(`hello my name is dyon and im ${a} years old` )
}

function natas(a){
    console.log(`hello my name is nATASJA and im ${a} years old` )
}

first(dyon,29);
//output my age is 29
//and my name is dyon

first(natas,39);
//output my age is 39
//and my name is natasja
psyperl
@psyperl
Sep 27 2018 13:48
const to_call_first = (k,b, callback, age) => {
  console.log("hello how are you and how old")
  k(setTimeout(x => callback(age),5000))
}
const promise_to_call_first = (c,a) =>
  new Promise( (k,b) => to_call_first(k,b,c,a) )

const dyon = a => 
  console.log(`hello my name is dyon and im ${a} years old` )
const natas = a =>
  console.log(`hello my name is natas and im ${a} years old` )

promise_to_call_first(dyon, 29)
  .then(promise_to_call_first(natas, 39))
May Kittens Devour Your Soul
@diomed
Sep 27 2018 13:50
is cors problem here to stay, or will it ever go away?
Kyle Holm
@thekholm80
Sep 27 2018 13:52
cors protects sites, so if anything it will get worse not better. in my uneducated opinion
psyperl
@psyperl
Sep 27 2018 14:09
cors indeed protects sites.. against fcc students attack :D
psyperl
@psyperl
Sep 27 2018 14:18

challenge 1:
try to drive the car in front of the mall.
steps1: find car with red color, if you find it approach it slowly and try to open the door
step2: if a dude stand next to it yelling "hey don't take my car" ..
it's ok.. it was a security and defensive attempt from a car owner to protect the car.
you can look at the forum to see how to get around this problem
step3: drive the car

remember if you get stuck, don't forget the search and ask method,

:trollface:

alpox
@alpox
Sep 27 2018 14:49
@learningjs42
function first(){
  console.log("hello how are you and how old")

  return new Promise(res => setTimeout(res, 5000));
}

const dyon = (a) => () =>
    console.log(`hello my name is dyon and im ${a} years old` )

const natas = (a) => () =>
    console.log(`hello my name is nATASJA and im ${a} years old` )


first().then(dyon(29));
first().then(natas(39));
Aditya
@ezioda004
Sep 27 2018 15:01
@learningjs42 If you want to wait for first promise to finish:
function promise(callback, age) {
  return new Promise(resolve => first(resolve, callback, age));
}
function first(resolve, callback, age) {
  console.log("hello how are you and how old");
  setTimeout(callback, 5000, resolve, age);
}
function dyon(resolve, a) {
  console.log(`hello my name is dyon and im ${a} years old`);
  resolve();
}
function natas(resolve, a) {
  console.log(`hello my name is nATASJA and im ${a} years old`);
  resolve();
}
promise(dyon, 29).then(_ => promise(natas, 39));
/*
hello how are you and how old
hello my name is dyon and im 29 years old
hello how are you and how old
hello my name is nATASJA and im 39 years old
*/
psyperl
@psyperl
Sep 27 2018 15:06
setTimeout(callback, 5000, resolve, age); i had difficult time setting extra param earlier
wonder how that works
Aditya
@ezioda004
Sep 27 2018 15:12
@psyperl Anything after the time is passed to the callback function as argument. Alternatively this also works:
setTimeout((resolve, age) => callback(resolve, age), 5000);
psyperl
@psyperl
Sep 27 2018 15:13
i like this one setTimeout(callback, 5000, resolve, age) better
that one is similar to yours.. much shorter
yeah i never knew that extra param is there.. thank @ezioda004
alpox
@alpox
Sep 27 2018 15:16
I wouldnt pass around the resolve function if there is another way
Thats like using promises to go back to callback style programming :D
psyperl
@psyperl
Sep 27 2018 15:17
i don't mind with callback style prog for now.. but yeah can see why one trying not to pass the callback around
that's like giving your number to the agency and the agency giving it out to who knows who that will call you back :smile:
alpox
@alpox
Sep 27 2018 15:24
Well the biggest problem with passing callbacks is nesting - which can be prevented but still gets ugly and hard to track after some time
Leena
@leena-d
Sep 27 2018 15:26
can someone explain what I did to make my flexbox stop working lke it should? code with issue marked here: https://repl.it/@leena_d/PoliteOffensiveCrash
psyperl
@psyperl
Sep 27 2018 15:28
o dear flexbox.. i am confused enough with grids.. let alone flexbox
Leena
@leena-d
Sep 27 2018 15:28
@psyperl they both confuse me
Aditya
@ezioda004
Sep 27 2018 15:38
The main problem with callbacks is the "inversion of control" and nesting, but since its your own callback you're in control of that
@leena-d Whats not working?
Leena
@leena-d
Sep 27 2018 15:44
the flexbox for my kits section of the page. when i look at it the content has no space between it even though it should @ezioda004
Aditya
@ezioda004
Sep 27 2018 15:54
@leena-d justify-content only works if there's leftover space, as you resize the page, the elements absorb this space
You could add max-width on the elements if you want space b/w them
Leena
@leena-d
Sep 27 2018 15:55
@ezioda004 so is it not working now because i added a footer? it was fine before then.
Aditya
@ezioda004
Sep 27 2018 15:59
I dont think its related to footer, both are sibling elements and doesnt affect each others flex property since their parent doesnt have display: flex
You can remove footer but it doesnt affect those elements in anyway
Leena
@leena-d
Sep 27 2018 16:02
@ezioda004 oh i know what it was now... i added more padding inside the boxes... changed it back and "problem" solved
Aditya
@ezioda004
Sep 27 2018 16:06
:thumbsup:
May Kittens Devour Your Soul
@diomed
Sep 27 2018 16:22
psyperl
@psyperl
Sep 27 2018 16:23
o no
Leena
@leena-d
Sep 27 2018 16:37
besides the lack of using a media query, why isn't my code passing all the tests?
https://codepen.io/leena-d/pen/RebOjW
Christopher McCormack
@cmccormack
Sep 27 2018 16:49
@leena-d you can click the Tests button and it lists why they fail
Leena
@leena-d
Sep 27 2018 16:55
i know. but i have an iframe/video element and my navbar links do lead to where they say they do. how are those still wrong? @cmccormack
Christopher McCormack
@cmccormack
Sep 27 2018 17:04
@leena-d the errors will tell you specifically what's missing/not matching
Christopher McCormack
@cmccormack
Sep 27 2018 17:13
@leena-d for example, test 5 is failing because class="nav-link" should be on your clickable element (a) not the li element
Leena
@leena-d
Sep 27 2018 17:20
@cmccormack thanks. i was misunderstanding what was in the errors. now i understand it
Christopher McCormack
@cmccormack
Sep 27 2018 17:23
np
psyperl
@psyperl
Sep 27 2018 17:33
wew my youtube recommendation is going in loop i think
now i know how they made million views :smile:
May Kittens Devour Your Soul
@diomed
Sep 27 2018 18:45
@thekholm80 you only think you know how basketball is played in south korea
Kyle Holm
@thekholm80
Sep 27 2018 18:46
@diomed well that's just smart
i don't recall any rule that says you can't have a giant inflatable puppet guard the basket
May Kittens Devour Your Soul
@diomed
Sep 27 2018 18:47
indeed
@thekholm80 as a devout react hippie, see my søøn link :point_up: September 27, 2018 6:22 PM
mby u'd love to contribute to the project
Kyle Holm
@thekholm80
Sep 27 2018 18:50
i don't know
i'm not really good at doing useful things
psyperl
@psyperl
Sep 27 2018 18:52
the more you know.. the less confidence you get...
May Kittens Devour Your Soul
@diomed
Sep 27 2018 18:52
I doubt it
Kyle Holm
@thekholm80
Sep 27 2018 18:53
i must be really, really smart then
psyperl
@psyperl
Sep 27 2018 18:53
lol
usually the reason why one do things is not because they feel confidence about it.. but it's just because one do not have any other choice lol
Kyle Holm
@thekholm80
Sep 27 2018 18:57

Confucius say:

“Education breeds confidence. Confidence breeds hope. Hope breeds peace.”

so therefore, i'm uneducated. or I just don't breed
Karma Drukpa
@coderkarma
Sep 27 2018 18:57
I have not been able to implement things that I've learned taking ONLINE courses on my webpage.
psyperl
@psyperl
Sep 27 2018 18:59
Education is not equal to knowledge though
psyperl
@psyperl
Sep 27 2018 19:00
so much params wew
May Kittens Devour Your Soul
@diomed
Sep 27 2018 19:04
I'm so much educated I don't know a damn thing
Karma Drukpa
@coderkarma
Sep 27 2018 19:04
wow ...
@diomed me to lol
psyperl
@psyperl
Sep 27 2018 19:06
well that's not what i meant, but education is a set of standard.. beyond that there are plenty more
Kyle Holm
@thekholm80
Sep 27 2018 19:08
@ezioda004 interesting take
psyperl
@psyperl
Sep 27 2018 19:11
i dunno is my opinion and i often wrong so :smile:
Aditya
@ezioda004
Sep 27 2018 19:13
@thekholm80 I wonder what hes referring to, just looked up and there was a tc39 meeting yesterday, probably something happened over there
Kyle Holm
@thekholm80
Sep 27 2018 19:13
that's my guess
the grand wizards of JS want things done one way, KS another
like a nerdy cat fight
Aditya
@ezioda004
Sep 27 2018 19:16
True, I was listening to this podcast yesterday about Go and why its so successful. The guy was talking about how they'll never evolve/add new features to it and he doesnt like how languages "borrow" features from one another, interesting philosophy
Kyle Holm
@thekholm80
Sep 27 2018 19:17
the idea of a static, complete language is interesting. knowing that when i learn it it won't be different next week is appealing
Aditya
@ezioda004
Sep 27 2018 19:18
But new features doesnt mean that whatever you've learned has become obsolete
Its just a different/better way to express existing stuff
Kyle Holm
@thekholm80
Sep 27 2018 19:18
sometimes it does though
how many pages have you seen on MDN that say "this feature is no longer supported"
Aditya
@ezioda004
Sep 27 2018 19:20
Hmm, not many..they dont stop supporting but deprecate
Kyle Holm
@thekholm80
Sep 27 2018 19:20
that's what i mean
Aditya
@ezioda004
Sep 27 2018 19:21
JS doesnt break backwards compatibility so thats good
But still the deprecated stuff is deprecated for a reason, like the arguments object whose behavior wasnt expected and there are bunch of gotchas with it
Aditya
@ezioda004
Sep 27 2018 19:25
Honestly, I've never heard/came across any of the mentioned obsolete features
But then again I've known JS for around 9 months
Akhabue Amendus
@amendus_akhabue_twitter
Sep 27 2018 19:26
hello odinites
Kyle Holm
@thekholm80
Sep 27 2018 19:26
i guess the general thrust of my original statement still is the idea of a static, complete language is interesting. knowing that when i learn it it won't be different next week is appealing
odinites?
Akhabue Amendus
@amendus_akhabue_twitter
Sep 27 2018 19:27
i need some assistance in basically inputting my a username and password
Aditya
@ezioda004
Sep 27 2018 19:27
Theres an appeal to it I agree
Akhabue Amendus
@amendus_akhabue_twitter
Sep 27 2018 19:27
sorry.....
Aditya
@ezioda004
Sep 27 2018 19:27
But at the same time you cant be in the industry and expect that you wont have to learn anything new
Kyle Holm
@thekholm80
Sep 27 2018 19:28
challenge accepted
Aditya
@ezioda004
Sep 27 2018 19:28
Lol
I'm really digging static typing, its relatively easier to read someone else's code with types
Kyle Holm
@thekholm80
Sep 27 2018 19:30
VBA was (is) typed
i didn't hate it
and you could recast a variable to another type, which wasn't awful either
Aditya
@ezioda004
Sep 27 2018 19:33
Its a programming language of excel? wut
Kyle Holm
@thekholm80
Sep 27 2018 19:36
yep
based on visual basic
Leena
@leena-d
Sep 27 2018 19:39
for the technical documentation page project does every section actually have to contain information or can i use random placeholder text?
Kyle Holm
@thekholm80
Sep 27 2018 19:40
you do it however you'd like
nobody is going to check your work
unless you want to put it on your portfolio and present it to potential employers/clients
Leena
@leena-d
Sep 27 2018 19:41
gotcha. thanks
Smootimus
@Smootimus
Sep 27 2018 19:44
:eyes:
Kyle Holm
@thekholm80
Sep 27 2018 19:47
what's up smoot
Smootimus
@Smootimus
Sep 27 2018 19:48
Not much man, just kicking it on this break off from school
Before the next quarter that starts on monday
Kyle Holm
@thekholm80
Sep 27 2018 19:48
oh nice
enjoying all that fall in RI has to offer?
Smootimus
@Smootimus
Sep 27 2018 19:48
Working on my network at home, I just got some new goodies. Modem and nice router
Kyle Holm
@thekholm80
Sep 27 2018 19:48
oh cool
Smootimus
@Smootimus
Sep 27 2018 19:48
Ah man, it's not so nice so far xD the weather has been crazy and won't make up it's mind.
Yeah I went to the store yesterday and splurged :O
I was a little peeved about the speed of my network and some things that was going on. And I wanted to get rid of that leased wifi modem/router garbage
Kyle Holm
@thekholm80
Sep 27 2018 19:50
leasing gear is a bad deal, usually
Smootimus
@Smootimus
Sep 27 2018 19:50
Very much so
Kyle Holm
@thekholm80
Sep 27 2018 19:51
have you watched any Linus Tech Tips?
Smootimus
@Smootimus
Sep 27 2018 19:51
I've seen it advertised and seen a few people speak on it, but I've never watched it myself
Kyle Holm
@thekholm80
Sep 27 2018 19:51
he's done some videos about their 10gb/s networking. it's pretty cool
Smootimus
@Smootimus
Sep 27 2018 19:51
I was looking at some of that gear yesterday, I almost made the jump on it but I refrained lol
I spent too much as it was, way more than I intended :'(
Kyle Holm
@thekholm80
Sep 27 2018 19:52
i guess they've leased an exclusive fiber optic spectrum from their ISP, i'm pretty jealous. 5gb/s normal, 10gb/s for all traffic within the isp
well, i think they get it straight from the exchange
Smootimus
@Smootimus
Sep 27 2018 19:53
That's pretty crazy
I was wanting to wait until verizon opened their fiber here, but they refuse to hit my street
Kyle Holm
@thekholm80
Sep 27 2018 19:54
i still know next to nothing about networking. but now you're an expert i don't even have to learn. i can just have you try to debug remotely
and yes, i turned it off and on again
Smootimus
@Smootimus
Sep 27 2018 19:55
LoL Remote stuff
I love it,
Cause I remember not using it for a long time :'(
I wanna get a server up and running
I wanna get hosting again
Kyle Holm
@thekholm80
Sep 27 2018 19:56
with apache?
Smootimus
@Smootimus
Sep 27 2018 19:56
Probably
Kyle Holm
@thekholm80
Sep 27 2018 19:56
and php?
Smootimus
@Smootimus
Sep 27 2018 19:56
I would love to have a couple machines
With different options xD
But yeah, that'll pro0bably be my first one
LAMP
Kyle Holm
@thekholm80
Sep 27 2018 19:57
i like the L, not all that jazzed about the rest lol
Smootimus
@Smootimus
Sep 27 2018 19:57
lol!
I figured ;)
But I would like to have atleast one more with a newer stack
I think two machines would be nice. Would satisfy my initial desire lol
Kyle Holm
@thekholm80
Sep 27 2018 19:58
i'm glad i don't have to pay your power bill
Smootimus
@Smootimus
Sep 27 2018 19:58
My ultimate is to just ahve a huge ridiculous server and database and just run whatever VM however
LOL You and me both ;) xD
Nah I kid, I kid. I have to pay some of it lol!
But that's what has kept me from it so far :'(
That struggle is real
That and the cost of building them u.u
Kyle Holm
@thekholm80
Sep 27 2018 19:59
can you run a drop cord to the neighbors?
Smootimus
@Smootimus
Sep 27 2018 20:00
I probably could, and have three I could immediatly choose from lol
Well, two...
One probably doesn't have any service :eyes:
Because they're bums
Kyle Holm
@thekholm80
Sep 27 2018 20:00
sounds like a good neighborhood
Smootimus
@Smootimus
Sep 27 2018 20:01
Teeeerrible
The one before was worse, tho
I actually had to file a report on that one u.u
Was hoping for an upgrade, didn't happen
This one is one of those free goverment hand out kinda deals u.u
Kyle Holm
@thekholm80
Sep 27 2018 20:02
ah
Smootimus
@Smootimus
Sep 27 2018 20:02
Im' like "How did you get in a freakin' condo...."
Kyle Holm
@thekholm80
Sep 27 2018 20:03
i'm not knocking it, i've lived in some pretty low-income places. especially in Appalachia
had a lot of fun times
Smootimus
@Smootimus
Sep 27 2018 20:03
Yeah same. This place is pretty nice and there nothing wrong with that. But their lifestyle
This is more like a disabled, retirement kinda condo associatation
Kyle Holm
@thekholm80
Sep 27 2018 20:04
interesting
i wouldn't hate that
Smootimus
@Smootimus
Sep 27 2018 20:04
And somehow we keep getting freaking... drug addicts and the worst in #12 lol
It's been really nice. REALLY nice
Kyle Holm
@thekholm80
Sep 27 2018 20:04
I just don't want to live in the "i have 30 kids and they all play outside your window until 1am" places
Smootimus
@Smootimus
Sep 27 2018 20:04
Just last 6 months maybe? 8 months?
Yeah that's like # 12
Except they are the kids
It's nice throughout the day, I've noticed since I been home from school lol
But once the sun starts to set u.u
Kyle Holm
@thekholm80
Sep 27 2018 20:05
the dream is to buy a big chunk of desert. that way there's no neighbors anywhere close
Smootimus
@Smootimus
Sep 27 2018 20:05
Yeeeees
Kyle Holm
@thekholm80
Sep 27 2018 20:06
i've been looking kind of near @cmccormack
Smootimus
@Smootimus
Sep 27 2018 20:06
my gf been pushin' for me to look at some property
It's tough in RI
You're either
In Newport, where it's $
that didn't let all the $ be printed so my statement won't make sense now lol
Neport is BIG mong
money
Middletown/ Little Compton is big money
Providence is meh. That's where I live now
So that leaves no where in RI pretty much lol
Kyle Holm
@thekholm80
Sep 27 2018 20:08
head up to Pennsytucky
Smootimus
@Smootimus
Sep 27 2018 20:08
I've been contemplating property back in Ohio =\
I just don't wanna be near my family xD
Kyle Holm
@thekholm80
Sep 27 2018 20:08
maine?
Smootimus
@Smootimus
Sep 27 2018 20:09
Property there that's like 50-70k is like 300k here in RI
Maine would be nice
NH would be, too
Kyle Holm
@thekholm80
Sep 27 2018 20:09
i hear that week of summer they get in Maine is awesome
Smootimus
@Smootimus
Sep 27 2018 20:09
LOL somethin' like that
That's my only hang up with going further north
The cold and omg that snow
Kyle Holm
@thekholm80
Sep 27 2018 20:11
after the last recession there were areas of florida selling property at like $9 ft^2
Smootimus
@Smootimus
Sep 27 2018 20:11
I would consider having a get-away spot down there
But I dunno about living
For extended amount of time
Kyle Holm
@thekholm80
Sep 27 2018 20:11
the humidity would kill me
i'm a delicate flower
Smootimus
@Smootimus
Sep 27 2018 20:12
GA was bad, I only have been in FL for spurts
I didn't really get to experience it full on down there, only a week orso at a time
Kyle Holm
@thekholm80
Sep 27 2018 20:13
i lived in NC for a while, it was miserable
Smootimus
@Smootimus
Sep 27 2018 20:13
That's where I was for 7 years in the military
I actually loved it
Didn't know I would miss it so much
May Kittens Devour Your Soul
@diomed
Sep 27 2018 20:14
: @thekholm80 be like :cherry_blossom:
Kyle Holm
@thekholm80
Sep 27 2018 20:15
@Smootimus go there, then. lots of inexpensive property
and there's a bit of a tech boom around greenville/winston salem area
May Kittens Devour Your Soul
@diomed
Sep 27 2018 20:17
:moyai::moyai::moyai::moyai::moyai::moyai::moyai::moyai::moyai::moyai::moyai::moyai::moyai::moyai:
Smootimus
@Smootimus
Sep 27 2018 20:17
^ I'd visit
Christopher McCormack
@cmccormack
Sep 27 2018 20:18
@thekholm80 yeah man head out this way
Kyle Holm
@thekholm80
Sep 27 2018 20:19
@cmccormack my other option was the SE corner of AZ, but i think the summers would kill me
Christopher McCormack
@cmccormack
Sep 27 2018 20:19
the desert?
Kyle Holm
@thekholm80
Sep 27 2018 20:20
yeah
i was looking east of tuscon, kind of around wilcox
Christopher McCormack
@cmccormack
Sep 27 2018 20:28
gross
why not a nice area near good food and stuff to do?
Kyle Holm
@thekholm80
Sep 27 2018 20:29
i want somewhere with no people lol
Christopher McCormack
@cmccormack
Sep 27 2018 20:30
don't let anyone in your house :)
psyperl
@psyperl
Sep 27 2018 20:31
i want somewhere with people, but people simply don't want to be with me :smile:
Kyle Holm
@thekholm80
Sep 27 2018 20:32
my biggest gripe is traffic. every time i leave my house i nearly get hit by people trying to drive while facetiming, texting, whatever on their phones
psyperl
@psyperl
Sep 27 2018 20:32
especially when i start talking about code and algorithm
Kyle Holm
@thekholm80
Sep 27 2018 20:32
i see probably 8 cars run red lights every day
psyperl
@psyperl
Sep 27 2018 20:33
that doesn't sound good
Kyle Holm
@thekholm80
Sep 27 2018 20:33
it makes me really angry
Christopher McCormack
@cmccormack
Sep 27 2018 20:39
@thekholm80 you don't work at home?
Kyle Holm
@thekholm80
Sep 27 2018 20:39
i do
Christopher McCormack
@cmccormack
Sep 27 2018 20:40
see I'm the same way, I hate traffic, but that's why I want to move INTO a highly populated area where I can just walk everywhere instead
especially if you work at home and don't need to drive through the congestion
Kyle Holm
@thekholm80
Sep 27 2018 20:42
i wouldn't mind living somewhere with good public transit or walkability
Christopher McCormack
@cmccormack
Sep 27 2018 20:43
I was in Portland recently, seemed alright
my buddy got a house downtown and it's great, less than 5 min walk to just about everything you would need
psyperl
@psyperl
Sep 27 2018 20:43
:car: :ambulance: :red_car: :tractor: :taxi: :minibus: :truck: :bus: :house_with_garden: :dog2: :walking:
Christopher McCormack
@cmccormack
Sep 27 2018 20:43
@psyperl that looks like it took a lot of effort!
psyperl
@psyperl
Sep 27 2018 20:44
lol
Henry
@GitHub-Henry
Sep 27 2018 20:54
in the act
image.png
Christopher McCormack
@cmccormack
Sep 27 2018 20:56
@psyperl gotta do it programmatically!
let a = 55357
let transports = []
for (let b = 56961; b < 56996; b+=2) {
  transports.push(String.fromCharCode(a)+String.fromCharCode(b))
}

console.log(transports)
// [ '🚁', '🚃', '🚅', '🚇', '🚉', '🚋', '🚍', '🚏', '🚑', '🚓', '🚕', '🚗', '🚙', '🚛', '🚝', '🚟', '🚡', '🚣' ]
no dog to ride though
psyperl
@psyperl
Sep 27 2018 20:57
lol ... but i want to walk the dooog
Henry
@GitHub-Henry
Sep 27 2018 20:57
all while she says, 'killing a man at a wedding, what sort of monster would do such a thing?'
Christopher McCormack
@cmccormack
Sep 27 2018 20:59
@GitHub-Henry I feel like I'm missing some context
Henry
@GitHub-Henry
Sep 27 2018 21:04
pardon the non sequitur
Christopher McCormack
@cmccormack
Sep 27 2018 21:06
@GitHub-Henry np haha
psyperl
@psyperl
Sep 27 2018 21:39
const sfch = String.fromCharCode
const pfix = sfch(55357)
const transports =
  [...Array(18).keys()]
    .reduce((b,v,i) => b+pfix+sfch(56961+v+(i*2)),[])
console.log(transports)
got the bike!
Christopher McCormack
@cmccormack
Sep 27 2018 21:44
paste or I won't believe it!
psyperl
@psyperl
Sep 27 2018 21:45
🚁🚄🚇🚊🚍🚐🚓🚖🚙🚜🚟🚢🚥🚨🚫🚮🚱🚴
me has proofs!
Christopher McCormack
@cmccormack
Sep 27 2018 21:46
a trashcan sign is not a transport!
psyperl
@psyperl
Sep 27 2018 21:46
lol
psyperl
@psyperl
Sep 27 2018 21:51
const sfch = String.fromCharCode
const pfix = sfch(55357)
const transports =
  [...Array(12).keys()]
    .reduce((b,v,i) => b+pfix+sfch(56961+v+(i*2)),[]) + pfix + sfch(57012)
console.log(transports)
// 🚁🚄🚇🚊🚍🚐🚓🚖🚙🚜🚟🚢🚴
easy fix!
Christopher McCormack
@cmccormack
Sep 27 2018 21:54
is .keys a shortcut for Array([lenght]).fill()?
Kyle Holm
@thekholm80
Sep 27 2018 21:54
ah yes, the old lenght
Christopher McCormack
@cmccormack
Sep 27 2018 21:54
oh neat
psyperl
@psyperl
Sep 27 2018 21:54
lol
what would you get with fill ? zeroed?
keys got index
Kyle Holm
@thekholm80
Sep 27 2018 21:55
i like fill
Christopher McCormack
@cmccormack
Sep 27 2018 21:55
undefined
but it's better than the nothing you would get without it because you can map over it
Kyle Holm
@thekholm80
Sep 27 2018 21:55
you can specify a value to fill with, can't you?
Christopher McCormack
@cmccormack
Sep 27 2018 21:55
yes
Kyle Holm
@thekholm80
Sep 27 2018 21:55
Array.fill(value)
Christopher McCormack
@cmccormack
Sep 27 2018 21:56
I usually fill with the low value if doing an increment
but with keys you can do that and just multiply by some value
psyperl
@psyperl
Sep 27 2018 21:56
i rarely use fill..
Kyle Holm
@thekholm80
Sep 27 2018 21:56
i rarely do anything
except whine
Christopher McCormack
@cmccormack
Sep 27 2018 21:56
yeah that's true
psyperl
@psyperl
Sep 27 2018 21:56
lol
Christopher McCormack
@cmccormack
Sep 27 2018 21:56
haha

I used to use

> Array(12).fill().map((v,i)=>i)
[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ]

but now I"ll use .keys thanks @psyperl

psyperl
@psyperl
Sep 27 2018 21:57
awesome
well whichever shorter i think
Christopher McCormack
@cmccormack
Sep 27 2018 21:58
fill is an extra step I never liked doing
psyperl
@psyperl
Sep 27 2018 21:58
[...Array(12).keys()]
Array(12).fill()
is shorter though
Kyle Holm
@thekholm80
Sep 27 2018 21:59
but fill fills with a single value
your way increments
psyperl
@psyperl
Sep 27 2018 21:59
ahh no index yet
Christopher McCormack
@cmccormack
Sep 27 2018 22:00
oh you get an empty object with .keys without using spread
hmm
will have to play with both I guess
psyperl
@psyperl
Sep 27 2018 22:00
yeah
Kyle Holm
@thekholm80
Sep 27 2018 22:01
[x for x in range(55357, 57012)]
psyperl
@psyperl
Sep 27 2018 22:01
oo range exist?
Christopher McCormack
@cmccormack
Sep 27 2018 22:01
my normal use is something like
> let min = 10
> let max = 20
> Array(max-min+1).fill(min).map((v,i)=>v+i)
[ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 ]
Kyle Holm
@thekholm80
Sep 27 2018 22:01
in python
Christopher McCormack
@cmccormack
Sep 27 2018 22:01
@thekholm80 man I wish
psyperl
@psyperl
Sep 27 2018 22:01
@thekholm80 lol
Christopher McCormack
@cmccormack
Sep 27 2018 22:01
range would be comma separated wouldn't it?
Kyle Holm
@thekholm80
Sep 27 2018 22:02
probably
Christopher McCormack
@cmccormack
Sep 27 2018 22:02
:ninja:
I guess this is longer, is there a shorter way to do it?
> [...Array(max-min+1).keys()].map((v,i)=>v+min)
[ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 ]
Kyle Holm
@thekholm80
Sep 27 2018 22:05
i wish fill would take a callback
or an increment flag
or something
Christopher McCormack
@cmccormack
Sep 27 2018 22:06
yeah it's pretty weak
psyperl
@psyperl
Sep 27 2018 22:09
yeah the fill one is shorter for that case
plus no side effect from min
psyperl
@psyperl
Sep 27 2018 22:18
Array(max-min+1).fill(min).map((v,i)=>v+i)
[...Array(max-min+1)].map((v,i)=>min+i)
saved 3 chars ( 5 if var name is 1 letter )
Christopher McCormack
@cmccormack
Sep 27 2018 22:23
doesn't work
Array will fill with undefined pointers or something like that so you can't map over it
psyperl
@psyperl
Sep 27 2018 22:24
it works
becareful spread op problem with previous statement
Christopher McCormack
@cmccormack
Sep 27 2018 22:25
> [...Array(max-min+1)].map((v,i)=>v+min)
[ NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN ] // Batman!
psyperl
@psyperl
Sep 27 2018 22:26
i + min
Christopher McCormack
@cmccormack
Sep 27 2018 22:26
ah
yeah that should be good nice
psyperl
@psyperl
Sep 27 2018 22:32
but i think i still prefer fill .. because it's cleaner
for that specific case at least
Christopher McCormack
@cmccormack
Sep 27 2018 22:36
only time I ever use that kind of syntax is when trying to make a functional solution to something like a codewars challenge or whatever
psyperl
@psyperl
Sep 27 2018 22:38
i use them often actually.. ( no clue if it's bad or good practice.. but willing to experiment )
and that's the thing.. i am on a code style transition.. which makes me worry
i postponed 1 project from last yet because i got confused how to implement error handling
till i learn Promise last week :D
Christopher McCormack
@cmccormack
Sep 27 2018 22:42
wrap it all in try catch
psyperl
@psyperl
Sep 27 2018 22:42
my future is a bit brighter
that's the thing.. try catch can't be in one line
but Promise can
Christopher McCormack
@cmccormack
Sep 27 2018 22:42
no I mean ALL of it
one error handler
:)
psyperl
@psyperl
Sep 27 2018 22:43
can't do still
try doesn't return anything
const x = _ => try {} catch {} syntax error
but yeah i planned to use one catch on promise :smile:
mapping the error in array or some such
Christopher McCormack
@cmccormack
Sep 27 2018 22:46
const x = _ => new Promise(resolve, reject, () => {
    try {
        /*...*/
        resolve('blah')
    } catch(err) {
        reject(err)
    }
})
psyperl
@psyperl
Sep 27 2018 22:46
oh
that looks bad haha
i never thought of that though
Christopher McCormack
@cmccormack
Sep 27 2018 22:46
oh it is bad
:D
psyperl
@psyperl
Sep 27 2018 22:47
i tried giving attribute name an error and it seems to work
const errHandler = ({
  Error("firstError") : firstHandler,
  Error("secondError") : secondHandler
})
so on catch i can just do
....
  .catch( e => errHandler(e)() )
that was my plan.. haven't tried it yet.. but i think it should work
Christopher McCormack
@cmccormack
Sep 27 2018 22:48
keep playing, you seem to be learning a lot and teaching us some :)
psyperl
@psyperl
Sep 27 2018 22:49
lol, yeah i have no one to talk to about code .. only this chat :D
Christopher McCormack
@cmccormack
Sep 27 2018 22:49
that' someone!
except I'm about to leave so I'll ttyl :)
psyperl
@psyperl
Sep 27 2018 22:49
ciao @cmccormack
yeah i meant everyone in this chat :D
and fcc discord except discord goes out of topic sometimes lol
Kyle Holm
@thekholm80
Sep 27 2018 22:53
we're always on topic here
psyperl
@psyperl
Sep 27 2018 22:53
lol right
petrockwd
@petrockwd
Sep 27 2018 23:09
Are you guys all complete freecodecamp curriculum?
Henry
@GitHub-Henry
Sep 27 2018 23:10
(async () => {
  try {
    let response = await fetch(url);
    let data = await response.json();
    render(data);
  }
  catch (err) {
    error(err);
  }
})();