Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Dec 21 2018 17:11
    @MadLittleMods banned @OmarAlmaqtri
  • Jun 05 2018 23:13
    @MadLittleMods banned @LWSS
  • May 25 2018 16:50
    @MadLittleMods banned @TheRedstoneTaco
Stephen James
@sjames1958gm
@Momentum-TN a promise can only be resolved once.
António Oliveira
@apspoliveira
what's the coding website you recommend to learn javascript?
Montassar Ben Dhifallah
@Momentum-TN
Hey @sjames1958gm, hope you are well :D
Thank you again for your non-stop help
Julian Gonggrijp
@jgonggrijp
@apspoliveira How far are you in your study path, what other languages do you know (if any) and what style of learning do you prefer?
António Oliveira
@apspoliveira
I like those web platforms that evaluate our solution. I would say I am junior programmer, I know more about C# as I prefer Object Oriented Languages
Julian Gonggrijp
@jgonggrijp
@apspoliveira Perhaps Project Euler or edabit?
António Oliveira
@apspoliveira
@jgonggrijp Edabit is paid, perhaps Project Euler.
Montassar Ben Dhifallah
@Momentum-TN
Hey guys, hope you are all well.
How to decode and display a tiff image in the browser using javascript ?
I found these libraries on github, but it seems they don't work: https://github.com/seikichi/tiff.js and https://github.com/GPHemsley/tiff-js
Julian Gonggrijp
@jgonggrijp
@Momentum-TN Perhaps a bit of a non-answer, but I'd be more inclined to "bounce" the image against an API that will do the conversion for me server side, with a tool like ImageMagick. Failing that, I would look for a JS library that can do the job client side, like you did, but I've never tried that.
svimanet
@svimanet:matrix.rongepaadl.com
[m]
Hi, I'm currently calling a redux action when expanding an interface. But the redux action is asynchronous and data does not reach state before the collapse/expand event is complete. What are my options to await state data before continuing operation?
1 reply
Tirlochan Arora
@tirlochanarora16
Hey everyone, wanna learn how to use Node js with Google Sheets? Checkou this link: https://javascript.plainenglish.io/how-to-use-node-js-with-google-sheets-c256c26e10fc
Joseph Henshaw
@Big-jo
please, in feathers.js I'm trying to populate a field returned after creating a document, how do I go about that ?
Justoverclock
@justoverclockl
hi guys, can anyone help me to replace math.floor with window.crypto?
Julian Gonggrijp
@jgonggrijp
@justoverclockl are you looking for documentation like this?
Justoverclock
@justoverclockl
yep but i've tryed, without success
Julian Gonggrijp
@jgonggrijp
@justoverclockl So did my link answer your questions or not?
Justoverclock
@justoverclockl
Sorry for the delay, yes this help me a lot
But now i have another question
const regex = new RegExp('\b(' + Object.keys(mappings).join('|') + ')\b(?![^<]>|[^<>]</[^p])', 'gi');
How could i use this to math only one word (and not all the same words in the same sentence), i need only one
Julian Gonggrijp
@jgonggrijp

@justoverclockl General tip, you can add correct whitespace and syntax highlighting by putting your code between code fences like this:

```js
// your code here
```

I'm using that below to reproduce your regex:

const regex = new RegExp('\b(' + Object.keys(mappings).join('|') + ')\b(?![^<]>|[^<>]</[^p])', 'gi');

I suspect removing the g flag might do the job (so the second argument becomes just 'i').

Justoverclock
@justoverclockl
thank u so much!
Julian Gonggrijp
@jgonggrijp
@justoverclockl Welcome!
Justoverclock
@justoverclockl
as u can see now it works pretty well except for the data-tooltip. It goes offscreen on mobile only. I think its not possible to fix this with css, maybe is possible with javascript. any advice on this?
1 reply
Verratdreizhen
@Verratdreizhen
Good morning am new here
Julian Gonggrijp
@jgonggrijp
hi @Verratdreizhen :wave:
Travis Boss
@travisboss
  const dropDownSelector = "div.coveo-facet-header";
  const parentDropDownSelector = "div.CoveoFacet"
  const activeClass = "is-active";
  const container = document.querySelector(".coveo-facet-column");
  const coveoFilterDropdowns = container.querySelectorAll(dropDownSelector);

  console.log(coveoFilterDropdowns);

  const onClick = ({ target: coveoFilterDropdown }) => {
    container
      .querySelector(`${dropDownSelector} ${activeClass}`)
      ?.classList.toggle(dropDownSelector);
    coveoFilterDropdown.closest(parentDropDownSelector).classList.toggle(activeClass);
  };

  coveoFilterDropdowns.forEach((coveoFilterDropdown) => {
    coveoFilterDropdown.addEventListener("click", onClick, {
      passive: true,
    });
  });
I have this bit of code and in the onClick I need to remove the previous activeClass when I click on a new dropdown, anyone have insight on how i can accomplish this?
Gourab Mahapatra
@mgourab:matrix.org
[m]
hello everyone !
I am new to programming and have been learning javascript. I have a small doubt.
when should I use 'var' and 'let' keyword? please help
Justoverclock
@justoverclockl
@mgourab:matrix.org difference between let and var is that scope of a variable defined with let is limited to the block in which it is declared while variable declared with var has the global scope.
2 replies
@jgonggrijp i have a regex that find and replace hashtag into links, but how can i parse only element inside a specific div/class/id?
21 replies
Gourab Mahapatra
@mgourab:matrix.org
[m]
ok
please wait
function discountPrices(prices, discount) {
  console.log(discounted);   // shows this as undefined
  var discounted = [];      // blank array which will hold our discounted values

  for (var i = 0; i < prices.length; i++) {
    var discountedPrice = prices[i] * (1 - discount);
    var finalPrice = Math.round(discountedPrice * 100) / 100;
    discounted.push(finalPrice);
    console.log(i, discountedPrice, finalPrice);
  }

  console.log('total iterations: ' + i);    // 3
  console.log('last discounted price is: ' + discountedPrice);   // 150
  console.log('last final price is: ' + finalPrice);    // 150

  return discounted;
}

var newResult = discountPrices([100, 200, 300], .5);
console.log('this is our discounted array: ' + '[' + newResult + ']');
Justoverclock
@justoverclockl
put your code inside ```
Gourab Mahapatra
@mgourab:matrix.org
[m]
oh ok
Justoverclock
@justoverclockl
put line 2 after, var discounted
you can console log after variable
Gourab Mahapatra
@mgourab:matrix.org
[m]
but var has function scope right?
anywhere in the function I can use it?
Justoverclock
@justoverclockl
var variables are 'function scope. ... It means they are only available inside the function they're created in, or if not created inside a function, they are 'globally scoped.
8 replies
Gourab Mahapatra
@mgourab:matrix.org
[m]
oh ok, got it now. thanks a lot
and I know that default value is undefined right?
Justoverclock
@justoverclockl
yep
Gourab Mahapatra
@mgourab:matrix.org
[m]
ok, thanks a lot
Justoverclock
@justoverclockl
;)
Gourab Mahapatra
@mgourab:matrix.org
[m]
where are you from?
Justoverclock
@justoverclockl
italy
9 replies
Gourab Mahapatra
@mgourab:matrix.org
[m]
flarum project? what's that?