« first day (2353 days earlier)      last day (2581 days later) » 

12:00 AM
@Ta
@Tantrik I think I know what's going on there mate. Basically $ means you want to resolve github.com/seebigs/dollar-js from the current scope but it doesn't exist. Make sure you add dollar-js.
 
surely there must be a fix without introducing another js file?
ah so If I throw this right into my index.html it will see that scope is there?
 
that's right. However, you must inject dollar-js using tempermonkey or something because codepen might not load it properly
BTW, why aren't you already into AS3 yet?
 
as3?
 
yeah, Actionscript 3
I found it pretty sick technology
you basically fire up a mini operating system on your browser and it does 10 times more jobs than JS
 
cause I've been trying to get this form to submit and not reload the page for about a week now
anything "new" I think is gonna confuse me lol
I'm so confused, the script fires, I get the success message but no email!
 
12:09 AM
hey, don't lose your hope yet. JS is not mature enough to do that to be honest.
 
butttt like a billion devs have told me, use ajax to stop page reload on form submission
lol for like two weeks now 0.0
hmm
interesting, if I move the preventDefault to after the alert, it will send to mail.php
when I have it right after the function call, it ONLY fires the success from the js file
I feel like i am so close! haha
 
one easy way to do it is, write a bot that goes to www.gmail.com, signin, click on send email, write email, then click on send
 
that's not really the goal
people basically come to the site and leave a message which gets emailed to me
 
right
 
12:25 AM
ok interesting - instead of using url: mail.php; I called just a text file and for some reason it doesn't read it at all. Any ideas why url: would be getting skipped completely?
 
not too sure what kind of witchery going on there but I'd assume you should call gmail.com instead of localhost
 
gmail doesn't really have much to do with this 0.0
 
I hate when I work too long and then my brain just blanks out on things that I know I've done before
 
@ales
@Alesana yurp
 
@Alesana Use Gunnar's glasses, it helps you to stay focused after looking at your screen for a long time
 
12:33 AM
@Tantrik you gotta do success: function(e) {...}
That way it knows where to get e from
Then put e.preventDefault(); as the first thing in the function
Wait no that's inside an ajax function haha I am mistaken, that code wouldn't sense
 
i have this
1 sec
 
Just put the e.preventDefault(); as the first thing.
before the ajax call
 
ok let me try
thats how I have it
 
What is your HTML like?
 
1 sec
 
12:36 AM
It looks like your using the submit event listener on your submit button not on your form by the id, but I can't tell for sure
 
ah do I want to target the whole form?
 
Yup
 
ooooo
 
I would give the form an ID just because
then serialize it by the id too
 
ok let me try that out
thanks
 
12:39 AM
Asynchronous doesn't mean that. Asynchronous means it might run after the next instruction. It might also run before. In this particular case, we observe that most of the time it running after the next instruction. It is not guaranteed though. — Thierry yesterday
^ would this not be "releasing zalgo" if this was the case?
 
hmm no go
still getting success but no email
 
@Tantrik I just found out you can embed Mailchimp form into Actionscript 3. Then you can easily embed Actionscript 3 on your webpage which is backed up by powerful Flash operating system
 
@jason
@JasonMarsh thats rad, i'll have to check that out. I just need to learn how to do this as an aspiring full stack dev :D
 
right
I'm already a full stack.
that's me
 
LOL
@Alesana i should note that if I change the url: to a url: text.txt; nothing happens with that file which is suss to me
 
12:45 AM
Try doing this and checking the console log to debug
      success: function (data) {
        console.log(data);
      },
      error: function (data) {
        console.log(data);
      }
Well if you're getting success just the success: one, then with the text.txt if you're not getting the success alert then you'd try the error: one
 
hm ok
lets see
lol I can't get it to log anything
not even when I do text
something else must be going wrong
ok weird!
I have "thanks for reaching out" as the alert
but I am getting "form was submitted" when clicked
 
$(document).ready(function() {
  $('form').submit(function(e){
       e.preventDefault();
        $.post({'mail.php', $('form').serialize(), function (data) {
            alert('form was submitted');
        }).always(function(data){
        	console.log(data)
        });
    });
});
 
:O
 
Hello guys, does anyone know how to target a string in an if statement?
 
@Brixsta Welcome to the JavaScript chat! Please review the room rules. Pleasedon't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
 
12:57 AM
Try that
@Brixsta What do you mean?
 
like if(input == "") {}
will that check if input is a string?
 
Inside of the if statement?
 
yeah
 
Did you try it....?
Ohhh you want to see if it is a string instead of an integer?
 
var input = prompt("How much did dinner cost?");
 
12:58 AM
or any other type?
 
yes
so if they enter a string I want to kick them out
and say you need to enter an integer value
 
well, think about it
if input is "test"
 
^^
 
what's "test" == "" going to return?
you can try it in your console
(f12 or ctrl+shift+c in case you didn't know about it)
 
@Alesana I keep getting "form was submitted" even though I changed that. The same thing is happening as well
 
12:59 AM
also, notice that prompt always returns a string
 
Are you sure it saved right?
 
yea tried an incognito
and diff browser
 
Why is there anyway to prompt a user so it inputs an integer instead?
is there*
 
@Brixsta By design that's not possible
You should look into doing a regex test
 
hold on here gonna suss around
 
1:01 AM
towc are you referring to NaN above?
 
that is so weird
 
have a look at parseInt
 
@Alesana any clue why it wouldn't even be firing the correct alert message?
 
@Alesana you're wrong
:D
 
@Tantrik If it's firing the old one you must not have updated the file correctly or are accessing an old file
 
1:04 AM
must be my host
 
@tow You can get an integer response from a prompt?
 
@Alesana if you can get a string, you can get its corresponding integer, yeah
 
No, a string. You parse that string into an integer, if you like.
 
Right ^^
 
parse it into a sandwich for all i care.
 
1:06 AM
$.sandwich(prompt())
 
@Alesana pulled the file from the server and the alert does say something different 0.0 cleared cache and all, is that a default message meaning something else is going wrong?
 
= 🍔
 
But I think he was asking to make it so the prompt itself gets an integer, but if you wonder that then he must misunderstand what a string vs integer is and think that an integer is a numeric string
 
λ🍔.🍔
when in fact, strings are numeric integers
 
@Tantrik I don't know why that's happening
lol
 
1:09 AM
so weird!
 
Are there benefits to learning code outside of getting a career or being an alpha nerd?
 
some of us enjoy it.
 
weird, even that different message on my phone too
 
Luggage, do you feel smarter after learning code? and if you do, has that transferred positively into other aspects of life?
i'm not trolling
i'm actually curious if learning coding makes your brain stronger, like training a muscle
 
smarter? no. You get more skillful over time as you would with anything you do regularly, but not smarter.
I have no idea.
 
1:13 AM
I don't have a career in coding, but I built a tool for my brother's non-coding related work that doubled his productivity
 
thats rad
 
And I have used it in my non-coding jobs before
 
Alesana that sounds like a marketable skill, what's your current job if you don't mind me asking
 
I quit my job because it was crappy lol. Now I am focusing all my time on learning coding
 
President of the United States
 
1:14 AM
lol same here Alesana
 
Shhhh
 
same
:O
 
corporate america sucked my soul dry
I have an accounting degree but office politics is some bs
 
@Luggage They can't know I spend all my time on SO chat, they'll judge me like they do when I go golfing
 
this ajax script is gonna be the death of me
 
1:20 AM
die
 
soon
 
@Brixsta programming helps because by building applications that could do anything, you have a generalized idea of how to get from start to end of something. Many people lack the concept of stuff depending on other stuff and having a flow that things need to go through. As a programmer, it's a must that you understand that everything comes from something, and you need to provide the somethings in a way or another
hey dugger
 
1:37 AM
That's a pretty good point ^^
 
hey child
 
oh muh gerd ajax is literally the worst
how many days would you guys work on a simple "contact me" form before trashing the idea lol. How do other people toss them up so effortlessly?
 
because ajax isn't hard
 
so lets see you solve it :O
 
This is what I'm currently working on: eclipse.games/community/forums it uses a shit ton of client-side fetching (ajax)
So... yeah...
 
1:51 AM
angular handles this easier T.T
 
ew, no
just use the fetch API
 
rip contact me form
 
It really isn't hard, nor should you be struggling so much; what's your issue?
 
well this is day 6 on this issue LOL
 
@Tantrik 1 hour
before I was done
 
1:53 AM
?
 
He's saying that it should only take you an hour to write a contact form
 
I know right...
now almost 40hrs lol
 
What's your current issue?
 
I have my form and my mail.php working fine and everything. I just wanted to bring in ajax to submit form and not reload page
haven't been able to get anything other than something that throws an alert on button click
 
have you checked out tutorials?
 
1:56 AM
sooooo many hahaha
I'm using the same code same structures, tailoring it to my form, but never seems to work
 
onclick = e => {
    fetch('/mail.php', { method: 'POST', headers: { 'Content-Type': 'application/json' } })
        .then(response => response.json())
        .then(data => console.log('data back from server', data))
}
thank me later
oh shoot, forgot to add a body
well, you'll figure it out
 
lol
well.. It may be time for a new career path LOL - i've been trying to learn this stuff for longer than i'd like to say D:
one day i'll have a contact form :P
anyone know a good place to learn javascript from another person? I have a shelf full of books that have done me no good
 
There is a site, but I don't recall what it's called
@Loktar what's that live coding help site thing with real people?
 
ah I did that once
if its not $35/30min anymore i'd do it again lol
 
codementor?
id something like that
 
2:05 AM
yeah, I think so
 
oh man these people earning a $1/minute at minimum
so expensive! lol
 
$60 an hour. That's not that much for a consultant, if you think about it
 
its not
but when you make that a day
it hurts lol
 
It wasn't so long ago that I was making less than that a day
 
isn't it the best
 
2:10 AM
a day??
lol damn
 
merica!
 
Retail
 
yeah that was 15 years ago for me I guess
 
I went from making $7.25/hour to $100k/year in a matter of 5 years
I've worked my ass off, always keeping my nose to the grindstone
 
I hope to get somewhere around 50k once I can do basic stuff
 
2:11 AM
It has been pretty miserable
 
I can make angular apps but cant figure out a contact form rip me
 
50k is easy
 
angular is a terrible place to start, by the way
 
I fix a companies clients websites for minimum wage go life hahah
 
most jr positions pay that
area dependant ofc
 
2:12 AM
angular is like the only way JS made sense to me haha
 
ANgular isn't JS--it's angular
That's the major problem it has
 
well the way it hooks everything up
made it very nice to understand
 
yeah, in very poorly designed ways
 
-shrug- people seem to pay lots for its use
thats my justification haha
 
yeah
there are tons and tons of angular jobs
 
2:13 AM
The last thing this world needs is another crappy angular dev that can't actually write any JS without it
 
lol
 
I had to mentor someone like this...
It was terrible
 
maybe they were just terrible
 
Yes, but it's not just him--it's everyone who jumped in bed with angular before learning JS and the standard libraries
You won't be an exception
 
it's not the tech it's the person
 
2:15 AM
oh no I agree, I just need to get my foot in the door any way I can
 
I've been doing this for almost 20 years now, the tech doesn't matter
 
Agreed to an extend
Certain people gravitate towards the easy way out just to make a quick buck
 
I have a CS degree, been studying for a while, know too much of a little of everything and still make $8/hr
 
Sometimes technologies/libraries make it easier for those people to make excuses
 
I went angular just cause I need out and its been 3 years out of school
 
2:15 AM
Angular is one of those libraries
 
sure
 
in the end who cares?
 
thats not for me to decide or really care about lol
 
I care
 
the end user isn't looking at the code.
 
2:16 AM
^
 
do whatever you can to make money
 
i've learned that, I wrote a beautiful app and bragged about the code
 
No, but when you have to work with and train one of these people, it starts to become an issue
 
nobody gave a shit about it, they cared that it worked
 
yeah exactly @Tantrik
 
2:17 AM
hello all
 
@loltospoon Welcome to the JavaScript chat! Please review the room rules. Pleasedon't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
 
Fuck the users, I'm talking about working with people on a team
 
there are always devs who talk about real coders etc., doesn't really matter
there are always bad devs and good devs
do what you like and what can earn you an income
 
im all for writting the best most progressive code possible. It just doesn't seem to be what is going to get me a job LOL
 
Having worked with terrible devs, and great devs, I can say for a fact that it's easier and a much better time to work with good devs.
That's why I care
 
2:17 AM
haha i'm sure
 
I've done it for 20 years, not just 5
 
Spare your future coworkers
 
I've worked with lots of shitty devs
in the end it's what matters to you
 
Good for your 20 years; they don't invalidate my experiences
 
yeah they do
in my mind :p
 
2:18 AM
No they don't
I SAY WHAT GOES ON IN YOUR MIND
 
you're just preaching hipster shit to be completely honest
 
NOT YOU
That's not true at all
 
DONT LEARN ANGULAR YOU WILL BE BAD, it's not goodf advice
 
I'm talking from personal experience
 
haha
I take it all with a grain of salt at this point, otherwise i'd be switching fields of study every 5 minutes
 
2:19 AM
I guess since I'm in my 20's, all of my personal experiences are hipster shit
good to know
 
you deal in a lot of absolutes
 
I'm a sith
or wait, a Jedi?
I forget which ones deal in absolutes
 
lol not sure sith probably
I'm playing Overwatch so half payin attn, I'm just saying the tech doesnt make a dev bad the dev does
and I was messing with you a bit @ndugger
 
I agree, my point was that some libraries make it easier to justify complacency. It doesn't mean you will be complacent, but it does tend to attract lesser/lazier devs
 
haha~
is it bad if I'm married and doesn;'t go out for a walk with my baby and wife on weekends?
We fought recently, we are trying to be friendly again atm.
 
2:23 AM
yes. nerds aren't allowed to go outside
 
^
@JasonMarsh took me a minute to understand what you meant lol
 
right
are you married too?
 
yea
 
sick
 
married with 4 kids
 
2:27 AM
btw, what's the powershell command to check size of your code base?
nice
 
idk never really use powershell
 
in ubuntu?
 
no I'm a windows guy actually
 
right
in CMD?
 
yea
 
2:31 AM
'yea' is not recognized as internal command
code climate vs codacy
which one is better for express.js socket.io app?
 
yea
 
yea.js
 
2:45 AM
If I have an object of objects and I want to convert it to an array of objects with the object key as a value of each object in the array, would the best way just be to loop through it and push a new element to an array?
I don't know if that made sense
 
obj of objs being { foo: {}, bar: {} }?
 
I have for example
{
	key1:
	{
		a:3,
		b:3
	},
	key2:
	{
		a:8,
		b:4
	}
}
 
what do you want it to become?
 
[
    {
		key:key1,
		a:3,
		b:3
	},{
		key:key2,
		a:8,
		b:4
	}
]
There we go
I don't know why the spacing is all weird
 
what is the purpose behind converting it?
 
2:49 AM
I am going to sort it by a, then loop through it and then put the keys in one array, and the data in another array to use with chart.js (I don't know why it wants it like that)
 
I love composing actions
 
It doesn't really make sense that I couldn't just give it an object but it wants data like this...
 
in Javascript
programming
my code is now all about composability
 
var data = {
    labels: ["January", "February", "March", "April", "May", "June", "July"],
    datasets: [
        {
            label: "My First dataset",
            backgroundColor: [
                'rgba(255, 99, 132, 0.2)',
                'rgba(54, 162, 235, 0.2)',
                'rgba(255, 206, 86, 0.2)',
                'rgba(75, 192, 192, 0.2)',
                'rgba(153, 102, 255, 0.2)',
                'rgba(255, 159, 64, 0.2)'
            ],
            borderColor: [
                'rgba(255,99,132,1)',
 
Object.keys(myObject).map(key => ({ key, ...myObject[ key ] }))
 
2:52 AM
Ah perfect, thanks
I was able to do it like... dataArr = Object.keys(curData).map(key => (Object.assign({key:key}, curData[key] )));. Am I missing something or was it right to use Object.assign?
 
If you can't use the enhanced object literal features, then yeah, Object.assign is correct
 
Ah I will look into literals, thanks
 
3:15 AM
Anyone using Opera on macbookpro?
I'm experiencing this same problem: forums.opera.com/discussion/1870152/…
 
3:44 AM
Hey guys can someone explain to me why my p5 program seems to use 112% CPU?
 
@Jack Welcome to the JavaScript chat! Please review the room rules. Pleasedon't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
 
Won't happen again
 
@Jack haha don't worry that's a bot that says that to every new member
 
@Alesana Well that's a relief :)
 
So no solution?
Wait but its not the editor thats using the CPU, its literally the website
 
I'm not sure I don't use p5 I just thought I would share
 
Thanks
 
 
1 hour later…
5:32 AM
Any math wiz's out there?
 
@Alesana Shoot
 
Bang!
 
Okay so I'm trying to figure out how to dynamically write text in canvas to take up 40% of the canvas width, while the amount of text and the canvas width are both dynamic
 
Boring
Try posting on stackoverflow.com
 
:| Meh it gets more complicated
But okay
 
5:39 AM
That'd be super easy if it was a SVG
 
Hmm
I don't know if it's possible to do it the way I'm trying
 
I can do it fine if the amount of text doesn't change, using tools like that ^^
So at a font size of (canvasHeight / 114), a certain amount of text creating a total text-width of 120 fits perfectly in a canvas with the height of 300
 
You just calculate the width of the canvas in pixels, multiple by 0.4, and add that to the x position of the canvas, minus the x position where you're drawing the text.
 
So I was thinking to see if there was some way to, using that information, draw the text at that font size (~2.6), compare the width of the text to 120, and use the height of the canvas to recalculate what the font size should be
@JennaSloan I'm trying to get a font size, not positioning
 
5:47 AM
@Alesana oh.
 
I'm confusing myself haha
wait the canvas is a square so the height is the same as the width but I guess the width here would be more relevant
 
@Alesana You'd have to know the width of the text you'd be writing
 
Right so I set the font to 2.6, then I write the text, then I get the width of the text, then I would have to reset the font
Because without a font size, it doesn't have a width (obviously)
Too confusing haha I will just not write text in the middle of my doughnut chart :P
 
Yeah that's what I'm using, I just am trying to figure out the equation that I would use
 
6:07 AM
It can be accomplished by just looping and adding/subtracting to the font size until it's the right size
Maybe that's the only way :O
Start with a font size of 1, check the width, if the width of the text is not the size I want it to be add 1 to the font size and repeat.
 
@Alesana That's a horrible idea
 
Why is that?
I didn't actually come up with it on my own it was shown here
 
6:32 AM
@Alesana This works: jsfiddle.net/5Lqcazg1/4
You might have to adjust it a little if you want it to fit inside a particular area of the canvas
 
Wow perfect
Thank you that helps a lot
 
Sure
 
That is so much better than what is suggested on the chart.js board
 
I already had it written in Java. :P
Here it is as a function: jsfiddle.net/5Lqcazg1/5
 
6:50 AM
Haha what a coincidence
Thanks for doing that, I just put it in using the chart plugin and it works excellent
Do you mind if I share it? There are a lot of people using that code I originally shared with you.
 
@Alesana I don't mind at all.
 
Great!
 

« first day (2353 days earlier)      last day (2581 days later) »