These are chat archives for FreeCodeCamp/HelpJavaScript

15th
Dec 2018
Pagnito
@Pagnito
Dec 15 2018 00:03
<a download={gif.name} href={gif.url}>
              <i className="fas download-btn socialShare fa-arrow-alt-circle-down" />
 </a>
cant understand why this doesnt trigger a download, im guessin because its something with the url, it just opens the url instead
if the url is like this "blob:http://localhost:3000/789e170b-efa8-432f-a4b5-a7644026307c" it works
but one that points to my firebase storage wont trigger a download
Brad
@bradtaniguchi
Dec 15 2018 00:08
I think there's a security thing about the URL, if its not the same domain it doesn't download it. Since it could be malicious
I think I rememeber reading something like that
Jason Luboff
@JLuboff
Dec 15 2018 00:20
Time to start reading about Electron!
Pagnito
@Pagnito
Dec 15 2018 00:33
if i have an div with a background image that makes a http request. will that call be made if its display none?
Jason Luboff
@JLuboff
Dec 15 2018 00:34
How does a div make an http request?
Pagnito
@Pagnito
Dec 15 2018 00:34
background-image
Brad
@bradtaniguchi
Dec 15 2018 00:50
@JLuboff haha thats hilarious
Jason Luboff
@JLuboff
Dec 15 2018 00:50
@bradtaniguchi Whats that?
Brad
@bradtaniguchi
Dec 15 2018 00:51
How does a div make an http request?
Jason Luboff
@JLuboff
Dec 15 2018 00:51
oh lol it didn't make sense to me :)
Brad
@bradtaniguchi
Dec 15 2018 00:58
Yea me neither initially haha
Jason Luboff
@JLuboff
Dec 15 2018 00:59
Oh well.. I'm out. See ya
Pagnito
@Pagnito
Dec 15 2018 01:51
anyone knows of a good library convert gifs to mp4 or webm
Pagnito
@Pagnito
Dec 15 2018 02:08
aaaaaaah
convertio has nodejs "coming soon"
Fei-DaDa
@Fei-DaDa
Dec 15 2018 08:35
hai
hi
Aditya
@ezioda004
Dec 15 2018 08:39
:wave:
Kelechi Chinaka
@ke1echi
Dec 15 2018 08:50
anyone care to look at my survey form https://codepen.io/kelechichinaka/pen/gKGVdo
dont know why i fail some test when the id are provided
Mohammed Boudad
@matrixersp
Dec 15 2018 09:04

@shekharramola There are two way you can change all the entries of an array:

let arr = [1, 2, 3];
arr.forEach((num, idx) => arr[idx] += 1, arr);

Or:

let arr = [1, 2, 3];
arr = arr.map(num => num += 1);

I'd prefer the second one

Zaza
@ForkInSpace
Dec 15 2018 16:53
Hi there!
Pagnito
@Pagnito
Dec 15 2018 18:04
how does this work,
console.log(status) >100
console.log(typeof  status) > string
console.log('100'==status) > false
console.log('100'===status) > false
console.log(100==status) > false
im seriously confused
alpox
@alpox
Dec 15 2018 18:32
@Pagnito that doesnt look right xD
Zaza
@ForkInSpace
Dec 15 2018 18:34
how do you define status @Pagnito
?
I normally do that stuff on node repl and I'm not getting what you're getting
image.png
if you familiar with js quirks I think the above is understandable :P
Pagnito
@Pagnito
Dec 15 2018 18:49
yea i know its not right, im not definin status
its a parameter in a callback function in a library
@ForkInSpace @alpox
i know it doesnt make sense
webp.gwebp(uploadData.file, webpPath, '-mixed', (status)=> {
})
i shoulda made that known sry
i m pretty sure this has something to do with the library im using, not js
alpox
@alpox
Dec 15 2018 18:58
@Pagnito Your library pushes you this: callback("100\nConverted Successfully")
Pagnito
@Pagnito
Dec 15 2018 18:58
@alpox aaaaah, thank you
alpox
@alpox
Dec 15 2018 18:58
Is it possible that you did not see whats after the newline? :)
Pagnito
@Pagnito
Dec 15 2018 18:58
@alpox true
alpox
@alpox
Dec 15 2018 18:59
@Pagnito To be honest, that library is written like the worst crap
Someone vomited that code out
Pagnito
@Pagnito
Dec 15 2018 18:59
oof lol
ya i cant find anything else thats free for converting gifs to webp, tho i cant say i looked at the source code to know it was shit
i was hoping to find gif to mp4 conversion library but i cant find anything thats free, besides ffmpeg, but i dont think i can use that on the firebase cloud functions
Pagnito
@Pagnito
Dec 15 2018 19:05
How do you know its written like shit? Im curious to know as im still noob
@alpox
alpox
@alpox
Dec 15 2018 19:06
@Pagnito I took a look at the sources
Pagnito
@Pagnito
Dec 15 2018 19:07
what gave it away tho, like what flaws did u see
alpox
@alpox
Dec 15 2018 19:11
@Pagnito 1. You don't give status code together with status description in one string. 2. Repetition of code squared. 3. No formatting of sourcecode (total mess) 4. Old comments with dead code which was never removed. 5. No promise support (one can argue about that one being a real flaw) 6. Logging output never removed - sometimes its done sometimes not....
I believe if I look further I'd find more
I better don't :D
Pagnito
@Pagnito
Dec 15 2018 19:12
i see, thnx
alpox
@alpox
Dec 15 2018 19:16
@Pagnito Lol and there is a pull request pending since 1 full year which would fix the callback status
Pagnito
@Pagnito
Dec 15 2018 19:16
oof
alpox
@alpox
Dec 15 2018 19:16
I better close that tab :D
Pagnito
@Pagnito
Dec 15 2018 19:16
thats odd, they have a website and everythng
lol
alpox
@alpox
Dec 15 2018 19:17
@Pagnito If you mean https://developers.google.com/speed/webp/ thats not from them
@Pagnito The repo web-converter is created by one individual as javascript interaction to googles webp
Pagnito
@Pagnito
Dec 15 2018 19:18
ooh
oh i didnt look at the url, i tohught that was a website associated with this library
alpox
@alpox
Dec 15 2018 19:20
@Pagnito webp is written in plain C
By google
Pagnito
@Pagnito
Dec 15 2018 19:21
i see
alpox
@alpox
Dec 15 2018 19:22
Do you even need this format? I do not believe that it is widely supported
Pagnito
@Pagnito
Dec 15 2018 19:22
i was rly suprised there isnt a bunch of packages on npm on converting gif to mp4
yea i wanted gif to mp4
alpox
@alpox
Dec 15 2018 19:23
@Pagnito I believe you'd find only ffmpeg wrappers for this
Pagnito
@Pagnito
Dec 15 2018 19:23
yea i did, but they require i also install fmpeg, but i dunno how to do that on the firebase cloud
and i feel like they wouldnt let me
maybe digitnal ocean would, but im working wit firebase atm
alpox
@alpox
Dec 15 2018 19:24
It builds up the necessary ffmpeg binaries on the go
Someone suggested that this works in firebase (maybe) :D
Pagnito
@Pagnito
Dec 15 2018 19:25
hmm interesing, thnx :)
ima try and give it a go
alpox
@alpox
Dec 15 2018 19:27
@Pagnito Btw. this will just install ffmpeg binaries and give you a string with the location of the binary so you can use the binaries from another module
Pagnito
@Pagnito
Dec 15 2018 19:27
like make a http request?
alpox
@alpox
Dec 15 2018 19:27
http request?
It has to do that on the server
Pagnito
@Pagnito
Dec 15 2018 19:28
i dunno what u mean in the last msg
what do u mean it will install binaries?
alpox
@alpox
Dec 15 2018 19:29
it will install the binaries to the firebase container
Pagnito
@Pagnito
Dec 15 2018 19:30
so the cloud server will install ffmpeg?
alpox
@alpox
Dec 15 2018 19:30
The module will
The module will install ffmpeg binaries in the cloud server
If the module is listed as a dependency
Pagnito
@Pagnito
Dec 15 2018 19:31
so will that allot me to use a ffmpeg wrapper?
alpox
@alpox
Dec 15 2018 19:31
It should, yes
Unless I understand wrong how firebase works
Pagnito
@Pagnito
Dec 15 2018 19:31
i see
alpox
@alpox
Dec 15 2018 19:31
I never used firebase to be honest
Pagnito
@Pagnito
Dec 15 2018 19:31
can i test this static thing on my local server?
alpox
@alpox
Dec 15 2018 19:32
I believe so
Pagnito
@Pagnito
Dec 15 2018 19:32
word ima try it now
Pagnito
@Pagnito
Dec 15 2018 19:44
im thinkin about makin my fetch calls in index.js before calling render to render the bundle, but i dont know how to pass that data to app state
Karma Drukpa
@coderkarma
Dec 15 2018 22:48
:wave:
Help needed...
class ControlledInput extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      input: ''
    };
    // change code below this line
     this.handleChange = this.handleChange.bind(this);
    // change code above this line
  }
  // change code below this line
  handleChange (event) {
    this.setState({
      input: event.target.value
    })
  }
  // change code above this line
  render() {
    return (
      <div>
        { /* change code below this line */}
        <input onChange={this.hangleChange} value=              {this.state.input}/>
        { /* change code above this line */}
        <h4>Controlled Input:</h4>
        <p>{this.state.input}</p>
      </div>
    );
  }
};
I am not able to update the input
abraham anak agung
@padunk
Dec 15 2018 23:54
@coderkarma you have a typo at onChange