JavaScript

Topic: Anything JavaScript, ECMAScript including Node, React, ...
Apr 23, 2020 15:38
hello! i am trying to implement a HTML-> PDF functionality. The HTML contains a google map with polygons, some text, some elements with background image. Any suggestions for how to go about this?
Sep 24, 2018 20:58
@rlemon thanks, i will try it out
Sep 24, 2018 20:51
*how would i
Sep 24, 2018 20:50
hi would i turn this jquery statement into vanilla javascript: $(this).siblings(".slider-gran").children(".slider-parent").attr("data-translate‌​");
Sep 24, 2018 10:53
hi, whats the difference between this.variable_name and var variable_name. i mean which one to use in which case?
Sep 22, 2018 10:25
hi, why would someone do this.variable_name instead of var variable_name?
Sep 19, 2018 12:31
with the difficulties i am facing learning about it, i might keep doing the same
Sep 19, 2018 12:27
whats your preferred testing setup?
Sep 19, 2018 12:25
@Neil could you please tell me what post.yields() does here? isnt this what is executing the ajax?
Sep 19, 2018 12:23
isnt testing based on certain assumptions :P
Sep 19, 2018 12:18
@Neil check this out https://codepen.io/SitePoint/pen/vGOrwj

this is browser base, same code, but works
Sep 19, 2018 12:13
but whats weird is this is a coding example from a "reputed" source
Sep 19, 2018 12:12
huh. ill do that
Sep 19, 2018 12:07
so what should i do? use a timer?
Sep 19, 2018 12:05
*CAN NOT figure out the error
Sep 19, 2018 12:04
Hi in the above code example for using TDD, i am getting an error like so

1) saveUser
should call callback after saving:
TypeError: Cannot stub non-existent own property post

I am using mocha, chai and siono. and can figure out the error
Sep 19, 2018 12:02
var chai = require("chai");
var sinon = require("sinon");
var $ = require("jquery");
var assert = chai.assert;

function saveUser(user, callback) {
    $.post("/users", {
        first: user.firstname,
        last: user.lastname
    }, callback)
}

describe('saveUser', function() {
    it('should call callback after saving', function() {

      //We'll stub $.post so a request is not sent
      var post = sinon.stub($, 'post');
      post.yields();

      //We can use a spy as the callback so it's easy to verify
Sep 13, 2018 17:37
@ShrekOverflow thanks i will try it out. hope to find you here in case i have any further doubts :P
Sep 13, 2018 17:21
*typical carousel like stuff\
Sep 13, 2018 17:20
@ShrekOverflow yes, for eg, clicking on direction arrows effects changes to the data attribute on each slide on the DOM, and also changes the translate value for each slide in the style attribute also on teh DOM. the translate value is determined by some math. also i have a window resize event. Apart form events like these, there is some math involving calculation for slide width base on number of slides to be show and other carousel like stuff.
Sep 13, 2018 17:12
forgive my ignorance, what does "I'd just mock it" mean?
Sep 13, 2018 17:11
@ShrekOverflow so what kind of tests do you suggest i should write for the carousel?
Sep 13, 2018 16:46
also any ideas about what kind of other tests i should write?
Sep 13, 2018 16:45
hi, i am new to TDD. i am trying it for the first time for a slider/carousel plugin i am trying to create. i am trying to add a test for the click event on the direction arrows but i am not sure how to do it using mocha. any suggestions?
Sep 11, 2018 11:51
check this out
Sep 11, 2018 11:51
Sep 11, 2018 11:46
i found this which seems to have exhaustive examples sitepoint.com/…
Sep 11, 2018 11:43
yup, i get the theory part of it. and i think its the right way to work. any resources to learn? preferably one that has a small project which makes use of TDD?
Sep 11, 2018 11:40
hi, I am trying to start doing Test Driven Development on the code my team writes. i am not able to find good articles/tutorials online for the same. the ones i have seen usually have a simple example with a code snippet not more than 50-60 lines. any suggestions for good resources for TDD?
Aug 15, 2018 18:14
but its a vast topic and i hope i could find someone who could show me the way
Aug 15, 2018 18:13
@TravisWhite hey, thanks... i ll check them out now... i guess i could also do some research on spectrograms
Aug 15, 2018 17:58
hello, i wanna achieve something like this youtube.com/watch?v=NTM48pwoXAo .the ideas is to upload a piece of music and then be able to "see" it. how might disney have achieved it and how might i achieve it through code?
 

Java

Dedicated to the discussion of the Java programming language a...
Sep 24, 2018 10:52
@geisterfurz007 understood @Wietlol ahh... thanks
Sep 24, 2018 10:50
ummm... like closures?
Sep 24, 2018 10:49
?
Sep 24, 2018 10:49
in which case should i bind the variable to this/
Sep 24, 2018 10:48
hey @Wietlol this is me from the this.var_name vs var var_name question in the JS chat group
 

Python

Room rules: sopython.com/chatroom Code formatting guide: tinyu...
Aug 15, 2018 18:26
@JGreenwell i think the animators must have used math to get those shapes though
Aug 15, 2018 18:25
we can collaborate if it interests you
Aug 15, 2018 18:24
i will study on all the material and keep you posted
Aug 15, 2018 18:23
i see
Aug 15, 2018 18:17
cool..thanks
Aug 15, 2018 18:16
right, i am researching on it now... please do share any material if you find any
Aug 15, 2018 18:15
create spectorgrams, right?
Aug 15, 2018 17:59
hello, i wanna achieve something like this https://www.youtube.com/watch?v=NTM48pwoXAo .the ideas is to upload a piece of music and then be able to "see" it. how might disney have achieved it and how might i achieve it through code?
 

HTML / CSS / WebDesign

This room is now defunct. RIP.
Aug 15, 2018 18:12
you could try asking in the javascript channel
Aug 15, 2018 18:12
sorry @SebastianNielsen i dont understand promises yet :(
Aug 15, 2018 18:01
not sure where specifically to ask for such help, hence posting here
Aug 15, 2018 18:01
hello, i wanna achieve something like this youtube.com/watch?v=NTM48pwoXAo .the ideas is to upload a piece of music and then be able to "see" it. how might disney have achieved it and how might i achieve it through code?
Feb 24, 2018 08:04
Hi, I am a front end developer and I use several task runners in my front end only code. I would like to know can task runners be used on backend, specifically .php files