/wdg/ - Web Development General

get in before the shitposters do

>Previous Thread
>Free resources to get started
Get a good understanding of HTML, CSS and JavaScript.
developer.mozilla.org/en-US/docs/Learn - a good introduction (independent of your browser choice)
developer.mozilla.org/en-US/docs/Web - General documentation for HTML, CSS & JavaScript
freecodecamp.com/
codecademy.com/
bento.io/

>Further resources
github.com/iRaul/awesome-portfolios - Portfolio examples
github.com/kamranahmedse/developer-roadmap - Roadmap
stackoverflow.com/ - Developers asking questions and helping each other

>Tools
jsfiddle.net/ - Use this and post a link, if you need help with your code
caniuse.com/ - Check browser support for front-end web technologies

Other urls found in this thread:

jsbin.com/jiceteleca/edit?js,console
discord.gg/wdg
gist.github.com/
crossbrowsertesting.com
css-tricks.com/couple-takes-sticky-footer/#article-header-id-3
boards.Sup
materializecss.com/media.html
twitter.com/NSFWRedditVideo

>get in before the shitposters do
>/wdg/
Looks like I was too late.

I fucking hate webdev, why the fuck didn't become a farmer or something else ?
All the idiots who can't do shit climb the ladders while we competent idiots remain down in the shitter.

Any idea how to 'store' how often an if statement is called in JS?

jsbin.com/jiceteleca/edit?js,console

I'd like the numbers to move up beyond 1 but with every new run the numbers are reset. Is this a matter for localStorage?

Yes

This is not my experience at all, given how I turned out to be shit and will be fired soon.

>Is this a matter for localStorage?
if it has to persist between site loads then yes.
If you only need it for the duration that soeoen is active on the site, then make it an array of arrays or objects, like
[["jim",0],["bob",3],["timmy",1]]

You CAN be a farmer and a freelancer webdev, i've done just that. It fucking sucks but its can be done. It is still miles better than being a construction worker and a freelancer webdev (don't even ask...).

>jsbin.com/jiceteleca/edit?js,console
First stop putting your else on the same line. At least use this style

if {

}
else {

}


How about you use an array?
let names = [
{ name: 'bob', times_called: 0 },
{ name: 'tommy', times_called: 0 },
...
]

if (names[Math.floor(whatever)]) {
names[Math.floor(whatever)].times_called++;
name = names[Math.floor(whatever)].name;
}


If you want the counts to persist across refreshes/tabs, then that is what a database is for.

The complete opposite is true. People get promoted until they are shit at their job. It's called the Peter Principle.

Brace style is just as much a personal choice as the colors of your syntax highlighting scheme.

>not using OTBS

Using

if (){
}
else {
}

vs

if
{
}
else
{
}


is a personal choice.

Using

if () {
} else {
}


is just stupid, because you can't comment that shit out.

1TBS is the best. Conditionals without braces are awful to read

What happened?

Nothing. I just didn't meet my employers' expectations so they're going to fire me rather than promote me as that user suggested they would.

is it okay to require D.js in both C.js and B.js? should i be using webpack to make it all 1 bundle even on the back end for a node app? (electron app, really)

Free webdev learning resources:

discord.gg/wdg

>is it okay to require D.js in both C.js and B.js?
yes
>should i be using webpack to make it all 1 bundle even on the back end for a node app?
no need really

>Free webdev learning resources
just post it here, faggot

>because you can't comment that shit out.
what a stupid fucking post
if (condition) {
doStuff();
} else {
fuckOff();
}

if (condition) {
doStuff();
// } else {
// fuckOff();
}

I usually do this
If(){
fuck()
}/*else{
don't fuck()
}*/

>acting like that makes any logical sense.
Clearly you do not maintain any code.

I'm too much of a brainlet to learn c++ and java market is overtaken by pajeets. How hard is it to get a job making pretty websites? Do I just make mockups like an art portfolio, send it in, and hope for the best?

I imagine that it's hard. There's a whole herd of graphic designers here in the Bay Area all desperate for work.

It makes perfect sense, but if you're autistic about it you could just skip commenting out the conditional and only do the body:
if (gum > 0) {
chewGum();
} else {
// kickAss();
}

Not that it matters anyway, since if you're maintaining any code with commented out chunks of code you're using version control way the fuck wrong. I bet you don't even use trailing commas.

What are you talking about? Of course I use trailing commas, because they make sense.

>What are you talking about?
Commented out code is code that shouldn't exist. All it will do is confuse the next person to take a look at your code. If you need it around for historical purposes so you can look back at it and re-implement it at a later date you have your git history.
Trailing commas result in cleaner diffs.

There is a whole channel full of links and books that were gathered over months. It would be impossible.

For some reason letsencrypt's certbot cannot access my /.well-known/acme-challenges directory
Has anyone here encountered this problem?
I'm running an Apache VPS on CentOS6.9

Perms?

Vue > everything else

>Perms
I'm sorry, this is my first go at managing a vps and don't really know the lingo. Can you clarify your question?

yes
and you are running it like this?
$ sudo ./path/to/certbot-auto --apache

>
>Nothing. I just didn't meet my employers' expectations so they're going to fire me rather than promote me as that user suggested they would.

How long have you been there? Jump ship and get more money doing it.

I've been there 3 months. It took me 1.5 years to find a job, so there's no way I'm just going to walk away from it. The idea that I could just jump ship and land at an easier, higher paying job is just ridiculous considering how shitty I turned out to be as a programmer.

>want to make css work in Safari
>can't run Safari if not using macOS
every cross-browser-testing service with modern Safari rendering is paid as well from what I have seen..

Don't know what to do. Not paying apple for a mac, just to make sure that shit works in their walled garden.

>let's encrypt
shit sux
the CA cert doesn't exist on some platforms, which makes it unusable for anything public-facing
>have to add --ignore-cert or whatever it is on weget
>stock browser on Samsung tablet didn't recognise it
>some smaller loonix browsers don't recognise it
>some combination of Win 7 and some IE version (can't remember which) didn't regognise it

gist.github.com/

>crossbrowsertesting.com

I'm a 33 neet how do I get a job doing what you do?

You gotta start programming every day.

First year college programming is good to teach you the essentials: variables, functions, data structures... After that, it's time to drop out, choose a focus, and then get on GitHub. Look for open source projects related to that focus (in my case, it's React/Node/AWS), fork them, run them locally, learn how they work, and then start fixing the small bugs or adding small features or adding documentation. Once you've got some idea of how things are made, you can make your own stuff, because that's fun, but working on open source stuff written by real engineers will help you more.

At the same time, do a little practice problems from a shitty book like Cracking The Coding Interview. This will prepare you for the stupid questions you get in interviews.

If you do a little of this every day, you'll be at my skill level in 2 years max - emphasis on MAX. Of course, without a 4 year degree, it's going to be even more impossible to get an interview.

GitHub will automatically build a portfolio for you, so you don't have to worry about that. What you have to handle yourself is networking, which just means having a nice LinkedIn photo and having 500+ connections. This is so you don't look like a bum or some shut in loser. As for how you build connections? Start with your first year college programming class. Add everybody. After that, I guess you could go to some programming event and meet some people and add them. Just find excuses to add people.

Oh, I forgot. Actually the most important thing you need to get out of networking is references, which is what college is good for. You need to get a handful of references. Professors or employed software engineers are the best, so be nice to everybody, work hard in groups, raise your hand in class, and get that fucking A.

how can i optimize my nginx config

>used Vue for a few personal projects and fucking loved it
>no jobs for Vue devs, everybody wants React and Angular

Does anyone have experience with animating SVGs? From what I've been reading it sounds like I can use either SMIL or CSS to animate.

How do I get rid of this on Sublime?

it tells you how
open the file and make the correction

There are legitimate reasons to comment code. You sound like you either work alone or a small poop company. Or most likely you don't get paid to program at all.

Beginner here, is it possible to make something like a guestbook on a github site? Right now I've got it working locally by storing the entries on a MySQL database, but can I make that work through github?

t. no clue what I'm doing

Anyone here uses Firebase? I'm using its storage service but I have no idea on how to track the progress of multiple uploads.

Can anyone here provide any helpful input regarding my problem?

Why are you trying to buy an expensive PC if you don't have any use for it? Just save your money.

the strongest use for it would be gaming, but I want to back it up with more stuff.

I guess I need more time to think about it

Github pages serves static content, meaning just simple files (html,css,js,jpg,etc.)
If you want to store user provided input, you have to use a separate backend, that stores that information and makes it available on user requests.

Thanks man, that clears it up

Probably not the right thread, but is there any workaround with loading custom html files when opening a new tab with Firefox 57+?

>There are legitimate reasons to comment code.
how about you name those reasons instead of spouting meaningless shit

yeah Mozilla blocked that shit

you can always have a server running on local host with your homepage
127.0.0.1:8080


maybe there's other ways

So I have a fully responsive website with a footer, which has no fixed height, so out of all options explored only the flexbox trick described here: css-tricks.com/couple-takes-sticky-footer/#article-header-id-3 works, but that fucks all the padding of the bootstrap theme for whatever reason, how could I fix that, can I just modify one of the flexbox things the article suggests to still keep the fix of the footer but not fuck up the paddings on the nav elements?

variable-height sticky footers is the dark souls of web design

Flexbox with a main container with flex set to 1 is definitely the way to go. It's impossible to help you without knowing what underlying css rules your bootstrap theme is using, but I'd guess it's applying padding to the body element. Try removing all margin/padding from your body and put it into your header/content/footer divs instead.

do you want the footer to be sticky and always visible or simply be pushed to the bottom, in case that the main content doesn't fill the entire page?

im not >63995905, but
you learn this in highschool cs.
you shouldn't listen to anyone on Sup Forums for advice on practices and you shouldn't expect anyone on Sup Forums to explain anything, just google it up, or use wiki c2 com.

you literally responded to my post asking for user to defend his stance by providing legitimate reasons to keep commented out blocks of code around without actually providing any legitimate reasons to keep commented out blocks of code around and instead telling me to "google it" (which funnily enough results in professionals stating the exact same shit I've been touting from the start)

in other words, you're spouting shit

I'm learning how to use basic system calls on Linux to simulate a web server. Just to be sure I didn't fuck up any syntax I downloaded the fsf.org page to be my server's index page. I use a normal mozilla 57 to access the page at 127.0.0.1:80, but when I write back to the browser for some reason it parses the page fine, but when I inspect the element it says there is no response header even if I do generate it properly, also the source doesn't get html highlighting.

Is there mandatory about the response headers I'm supposed to send? I find it weird that it doesn't detect my headers, but until I remembered to include the HTTP protocol in the first line it didn't want to parse the page at all.

I had to apply the flex to both a wrapper container and the content for it to work without fucking up everything else, really weird, but it works, thanks anons.

post your headers

Fuck, code is back at my workstation, but off the top of my head its just the status and three things, something like this:

HTTP/1.1 200 OK\r\n
Date: (the current date)\r\n
Server: My custom server\r\n
Content-Type: text/html;charset=utf-8\r\n
\r\n

As for the last header, regarding content type, could it be that I'm not actually sending utf-8 charset characters? I just copied that content line because I thought it was the culprit for something else while I simply read and send from the page I downloaded from fsf.org. Also, I just remembered the page never stops loading, even when I close the file descriptor that represents the connection towards the browser. Could I be forgetting to send something before closing the connection?

shot in the dark but don't you need to specify content-length?

Thanks, Ill try to remember that tomorrow morning, although we could be mistaken since the is no field of that type on, say, fsf's page. It might be something else entirely, I remembered that neither does accessing the server through telnet close when I close the socket. It could be something not related to /wdg/. Sorry to bother you in that case.

I love the font I use on my website but the commas are too small, resembling periods waaaaaaay too much. Is there a semi-simple way to change the font-family of all commas in displayed text?
In particular: how do I avoid applying the changes to commas inside of nested tags?

Since you can't know what fonts people will have on their computers, all that effort could go to waste.

I’m afraid of the internet
boards.Sup Forums.org/g/thread/63997786#bottom

>Server was developed using C++, it means that it is very powerful and can't be overloaded.

What am I watching

How do i prevent css columns from breaking within a list item? I have an ordered list styled as
{
font-size: 8pt;
column-count: 3;
column-gap: 2em;
}


I dont want any list item to be broken over multiple columns.

and the container is fixed height currently?
Has to be allowed to adapt to the content or enable overflow scrolling otherwise.

it isnt fixed height as far as i know

1. In larger companies everything is compartmentalized. You can program features on the back end that aren't ready on the front. Would you delete that code or put it in a different file? No, you would comment it out and wait for the slow ass.

2. Using the agile method you push updates in intervals. If it is the end of a cycle and one feature is not ready but others are, would you delete all of that work? No, comment it out for the commit then keep working on it next cycle.

3. You have several debug variables and functions on your development server. Would you delete them every time and re-add them? No. You comment them out before pushing to stage. The aggregate in the work flow would remove comments before pushing.

How many examples before you apologize?

Flex box is not compatible with older browsers

I started working part time as a JavaScript programmer. I didnt have any job experience before and my boss is telling me to comment every single line of code and describe what it does, which is kind of dumb assuming my boss should know better than me what does a line of code do with a brief description at the end of a function or class.

edgecases break new browsers too... just had some issue with overflow: scroll

CanIuse.com

He is referring to commenting out code.

But you are correct. Code should have descriptions of the purpose, inputs, and outputs along with the author.

The first two of your problems can and should be solved by having a proper feature branching and continuous release workflow. The third should be solved with environment-specific configuration files or, if have absolutely no other choice, #ifdef or some equivalent mechanism.

>Code should have descriptions of the purpose, inputs, and outputs along with the author.
to think i share a board with these people

what's wrong with his answer?
I was asking because on college, teachers taught me to include small description of what the code does at the end of it, but my boss says I should comment every single line/operation/variable.

Who's right/wrong and why?

Its not whats wrong or right, rookie.

If your boss want you to comment every single line of code, you fucking do it.
As long as you describe what your code do, it should be fine.

Has anyone used materialized css before?

It has the perfect simple slider but it's cutting my image off at the bottom where the animation would go. I've tried object-fit: contain and setting max-height and height. But nothing I seem to do will fix this.

materializecss.com/media.html

It's under slider. And if I include the height parameter it seems to break it and it becomes an image. Posted a screenshot of it cutting off image.

If your boss tells you that you should comment everything and you're not in power to argue against it you should probably just swallow it and do what he says if you intend on keeping your job, but generally, you should strive to write code that documents itself by using good and descriptive variable names and functions. Instead of creating a function like function cmp(a, b) and decorating it with a comment stating "this is an employee name comparer function that compares two employee objects" you could have just written function compareEmployeeNames(employeeA, employeeB) and made its purpose clear from the get-go. Save commenting for things that can't be rewritten to make their purpose clear at a first glance, like complex regexes or whatnot.

Writing down your author name is just plain unnecessary, because your version control will take care of that should you need it to attribute certain changes or mistakes to people.

>I have never had a programming job in reality
Good luck out there

I'm more curious about what sort of place you work at where they happily accept such plain terrible coding advice.

Thanks for the advice, sempai.

Just one last question since I am kind of new in programming.
I've seen people here saying I am wasting my time learning web development and should focus more on learning "better" languages like .NET, C# and C++.
Are they right? Plz no bulling I am just searching for answers.

If Sup Forums says anything is a waste of time, you can most likely disregard it. Learning any programming language as your first will only make learning your next language easier, so even if you do end up coming to some realization that learning JS or PHP or whatever was a "waste of time" you will still be miles ahead of where you first where when you move on to your next. If you think web dev is fun and you enjoy using your languages and tools of choice, why should you stop?

That said, in the web world everything moves at mach speed and there are some genuinely dead languages and tools like Less, CoffeeScript, Bower etc., but you're most likely not using them already so you shouldn't worry too much. If you want to stay safe, you could always google "is XX dead", limit results to the past year and see what people have to say.

And as a side note since you mentioned it, C# and .NET can be used for web development with ASP.NET and has lots of resources that are well-suited for beginners.

Why do people in Sup Forums shit on web developers? I'm trying to learn to become one and i'm wondering why it has a bad rap.

they hate us can't they ain't us

basically muh secret club syndrome. web dev is much more tangible and accessible than ”real” development