/wdg/ - Web Development General

>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/
google.com

>Further resources
github.com/kamranahmedse/developer-roadmap - Roadmap
youtu.be/Zftx68K-1D4 - Web Development in 2018

>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:

example.com/foo'
blog.realkinetic.com/elm-changed-my-mind-about-unpopular-languages-190a23f4a834
security.stackexchange.com/questions/12568/is-e-mail-a-direct-vector-for-xss#12569
owasp.org/index.php/XSS_(Cross_Site_Scripting)_Prevention_Cheat_Sheet
developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes
en.wikipedia.org/wiki/List_of_Internet_top-level_domains
jsfiddle.net/mznkexb8/6/
stackshare.io/python/in-stacks
hyper.sh/
twitter.com/AnonBabble

Have nothing to do at work because we need to have our fucking stupid "user story" meeting and have been putting it off for a FUCKING MONTH.

Meetings, huh, good god
What are they good for
Absolutely nothing!

I have to make a doctor's appointment tracking website should I use Java/C# or Python for the backend?
>inb4 brainlet

Why does Laravel-lumen suck so much? I used flask+peewee for a personal project and it was amazing - minimal config, maximum deveopment speed.
I have to use lumen at work and it seems that making the simplest thing is some sort of a hack. The community is shit too. Hold me Sup Forums

Thing that puts me off going into web dev professionally is how much of an fuckin office job it sounds like. I love sitting down at a computer but loathe office culture, sounds like a paradox but it's real.

>Java/C# or Python for the backend?
use PHP. who the fuck does backend in python?

Who the fuck still uses PHP for new projects?

Who the fuck starts new projects? Just work in a legacy app

I checked out PHP once and didn't like it very much.
Still considering to learn Laravel anyway, just because people praise it constantly, but I feel like I would just trick myself into using a language I don't really like by using a framework as a kind of abstraction.

90% of jobs also look for people with PHP skills.
Just use Node.js, hell I would even learn Go, just to be able to have the opportunity to apply for some non-PHP position.
It's all AngularJS, PHP, AngularJS, PHP, AngularJS, PHP

So do I give in and learn Laravel? Especially since it seems to pair well with Vue, which I enjoy a lot.

I know there also is tons of Wordpress work obviously, though from my experience using it personally, before I knew anything about webdev I would want to stay away from that as far as possible.

Use elixir. You will thank me later

Dont! Stand out of the crowed by learning elixir and elm.

Is there any money left in affiliate marketing or is it just a meme? I've got a good niche, just need to make the site using a shitty wordpress blog

Who the fuck has a job? Just be a NEET

I'm making a simple 3D engine with WebGL. What is the correct way to structure large JavaScript projects? Not sure what to delegate to different classes, or whether to stick to OOP principles or try a purely functional approach

It has been two long weeks.

I still can't get nginx to work as I want it. Send help.

I just want it to process;
www.site.com => www.site.com/index.php
www.site.com/login => www.site.com/index.php?=login
www.site.com/login/name => www.site.com/index.php?=login/name
www.site.com/statistics => www.site.com/index.php?=statistics


and;
Not break site URLs for Javascript/css
Not ask me if i want to download the file rather than process and serve it
Not give me NGINX 404's (I handle them in my rouer)
Not give me NGINX 500 errors.

server {
listen 80;
listen [::]:80;

root /home/username/www/site;
index index.php;

access_log /var/log/nginx/site/access.log;
error_log /var/log/nginx/site/error.log debug;

server_name site.*;

location / {
try_files $uri $uri/ $uri.php;
#try_files $uri =404;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_script_name;
include fastcgi_params;
}

location ~* /.+ {
rewrite ^(.+)$ index.php?url=$1 break;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_script_name;
include fastcgi_params;
}

location ~ /\.ht {
deny all;
}

sendfile off;
}


Closest I have gotten after I have tried everything i can think of;
I either get it to not break css/js and it serves my homepage and other pages are broken.
The rewrite works and it serves all my PHP pages, with no CSS or JS because their links get broken.

Please, I am begging anyone.. Please... Help me. No end of googling has saved me, I have just been fucking around with this file for 2 weeks and just recycle the same results.

This is the closest I have gotten, redirect works fine but JS/CSS is broken...
server {
listen 80;
listen [::]:80;

root /home/dan/www/site;
index index.php;

access_log /var/log/nginx/site/access.log;
error_log /var/log/nginx/site/error.log debug;

server_name site.*;

rewrite ^(.+)$ /index.php?url=$1 break;

location / {
#try_files $uri $uri/ index.php;
}

location ~ \.php {
#try_files $uri =404;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_IkNFO $fastcgi_script_name;
include fastcgi_params;
}

location ~ /\.ht {
deny all;
}

sendfile off;
}

Web dev forced to do devops because of resourcing at my company.

I have been fighting with CloudFormation for a week, and switched to terraform + ansible + packer today.

It's so fucking nice, I'd probably kill myself if I didn't find these.

First off, they're good for shared vision on a project at multiple levels, both individual tickets and architecture. This is among the most important factor for success of a project.

Second, they're good for business planning. I'd rather have a medium speed project where I know when people are falling behind and I know how long it's going to take than have a fast project that just happens to get in on time.

Meetings aren't useful when they lack structure or could be handled asynchronously. They can also appear to be useless when all you think about is coding instead of programming as a whole.

How would I do a kind of... reverse query? in rails.

I have a table UrlToLead with url_pattern:string, lead:string

An example record would be (url_pattern: 'foo', lead: 'bar')

I want to be able to query using a parameter that's a fully qualified url, like 'mydomain.com/foo' and return 'bar'

Like a reverse like statement. Is this possible with a query? Should I use a block and iterate? Or am I going down the wrong road?

>meeting
More like a sarcasm circlejerk.

Wtf is a "user story" anyway?

Affiliate marketing is just a meme.
Only yuropoors like those

It's a way of writing ticket that captures who the ticket is for, what they want to do, and why they want to do it.

A user story seems like a stupid abstraction when you're working on tickets, but when you're writing them they're hugely useful for capturing requirements.

The important thing is to not let them get in your way, then whoever is writing them won't have your work get in their way. You can capture multiple user stories in one pull request or use multiple pull requests for one user story.

Would this be as good as it gets, or is there a railsier way?

referrer = 'example.com/foo'
UrlToLead.where { |utl| referer.include? utl.url_pattern }


The table shouldn't be more than a few dozen records.

So a where block returns a WhereChain, so you need some pointless 'not' chained to get a relation.

UrlToLead.where { |utl| 'foobar'.include? utl.url_pattern }.not(lead_source: nil).first.lead_source


this seems lame as fuck. what am i missing?

This is what I ended up with

def find_lead_source(url = "")
sources = UrlToLead.select { |utl| utl if url.include? utl.url_pattern }
sources.empty? "Web" : sources.first.lead_source
end


If there's a better way, lemme know pls

page10

I don't use PHP at all, but from what I know, I am certain, that you don't handle routes in nginx like that.

>site.com
>site.com/login
>site.com/login/name
that should all go to the same index.php, without any interference from nginx and then the actual backend (not nginx) sorts out, what the query/parameter is.

At least that's how it goes with Node and Express.
Every (non-static resource) request is forwarded upstream and Express will check for a matching route, whether it's queries or route parameters.

In your case you are trying to change route parameters to queries, but why?
PHP or whatever framework is surely able to handle a URL like 'site.com/login/name', given that the route is set up properly.

Key is to have a good BA and not hire bad BA's.

Yeah, elm looks good.
Just read this: blog.realkinetic.com/elm-changed-my-mind-about-unpopular-languages-190a23f4a834

The problem with this article is that it doesn't go into downsides years down the line, which is always the problem with unpopular technologies.

Elm will be around for a long time. Currently the creator is being payed to continue developing the language from NoRedInk. They made a huge investment into elm and it's very unlikely that they stop supporting it.
But even in the very unlikely case he'd lose his job, there are safeguards in place that would keep it going

How can i do this in javascript?

I want an asynchronous function that runs in a loop every second

window.setInterval

what do u guys think with .net core?

I'm not quite sure what you are trying to acomplish here..

One thing you can do is grab the part from the URL in an controller and redirect to the result to a differnt controller with a simple SQL LIKE-statement search..

class LeadController < Applicationcontroller

def index
if params[:s] and not params[:s].empty?
@results = UrlToLeads.where('url_pattern LIKE ?', "%#{params[%s]%" )
else
@results = []
end
end

private

def search_params
params.require(:lead).permits(:s)
end
end

A differnt solution in "pure Ruby" would be to extract/filter the search string before you process it further:

some_url = "blahbla.com/xyz"
search_string = some_url.split("/")[-1]

do I need to worry about sanitizing form data if all I do is pack that shit up in an email and send that?

No, not unless you mind someone is exploiting your database.

Who do you send it to?

You might need to do output filtering to avoid XSS, as some email clients happily run javascript...

See: security.stackexchange.com/questions/12568/is-e-mail-a-direct-vector-for-xss#12569
And: owasp.org/index.php/XSS_(Cross_Site_Scripting)_Prevention_Cheat_Sheet

it's not getting in contact with one, it's just a "drop us a message" kind of form that sends an email to the people who run the site with the message

thanks

So I should just always call index.php and handle the URL that way instead of rewriting the URL

It's my own framework and worked fine with Apache but configuring for nginx was odd. I will look into changing it.

I got it working either way. I just had to capture the public URL (images, CSS, JS) and not rewrite them.

>2018
>javascript classes still don't support variables
webdev is a joke

Recommend me ideas for my first real web app. It's semester project for Uni if that matters, would like to include it in a portfolio too.

> still using JavaScript in 2018
You don't have to use it, there are many alternatives.
I prefer Elm.
Other reasonable options are ReasonML, GHCJS, ClojureScript or PureScript.

And if you can't into functional, than at least use TypeScript

You mean these:
developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes
of course they support variables??!

>It's semester project for Uni if that matters
It's always going to be a PoS, so don't worry about it.

I remember during my first uni class building a medium-sized webapp, 18 people in a single team. Needless to say, that shit didn't work out.

build something you want to build, not what others suggest.
It will become a chore otherwise, that you don't enjoy working on.

>It will become a chore otherwise, that you don't enjoy working on.

that's the job though, better get used to it

yeah, but you also get paid to make up for it.
Doing something for grades or other potential future benefit doesn't have the same psychological effect.

What is /wdg/'s opinion on Spring Boot? I actually really enjoy working with it and find it fantastic.

Hey how are yalls jobs?

I'm trying to figure out if I want to leave or not.

I can show up whenever. I am not micromanaged. I have my own office. Coding standards are pretty chill. Basically as long as it works I'm good. Pay is low but high for the area. Make 52k when average household is 36k. So more than the average family here.

Now a recruiter called me about a gun ecommerce site job. Anyone have experience with that? The pay is double which puts me at the household average income of that area. Any idea if ecommerce companies are chill? Like really not all that much work to do on a functional site, right?

what area?

>any year
>not using the superior prototypical inheritance mechanism available in javascript

South USA

Master your self master the enemy.
I made some advice what build with node js and ruby.
pic related

Not the guy who asked, but I should have gotten that from "gun ecommerce site".

Are you high right now?

High on life.

who /comes here to bemoan their lifes situation of being a self taught neet, that fucked up in life and found a hobby in webdev, but prefers a stack that no company is interested in and can't deal with other people in business culture anyway/ ??

Me. In addition, I have high social anxiety and low self esteem which is why I don't see myself in any office where there is constant contact with other people. Currently, I'm applying for other solitary jobs. Wish me luck.

Well, I've been working on my thesis for so long that I have learned to code, started two businesses and still haven't got my degree.

I also tried to look for a job at the side, but that hasn't been very fruitful either.

what do you do in your free time?

What's the opposite of restful web service? If I dont use HTTP methods to request JSON data but instead create a "normal" backend?

Right?

Anyways, how are yalls jobs? Pretty chill or what?

How do I use webpack for a github pages Jekyll site?

Gaming. Fighting sports.

Should I use .io domain for my web dev portfolio? I'm not sure if it's still cool and trendy.

Thats how all dropout millionaires begin.

I would use .com if you can. Just keep brainstorming for a name.

.com seems too 90's for me. Does anyone know why .cu is so fucking expensive? What does it even mean? I understand .lol and other le funneh domain names, but .cu?

>not using .dog

.cu is for Cuba, just like .io is for British Indian Ocean Territory, .us is for United States, .co is for Columbia, etc.

afaik all two letter top level domains are country code top level domains. .lol and ones like that are mostly generic TLDs. A list of all of them is here:
en.wikipedia.org/wiki/List_of_Internet_top-level_domains

"Cu" means asshole in brazilian portuguese.

I just want to say, that pugs way of templating is terribly abstruse and not fun to work with

I use empty padded divs set invisibe on breakpoints to aerate the layout on desktops

discuss

Why use .io?
You want your portfolio to reach every normie possible and using .com is the easiest way to do that, everyone knows what .com is even 70 year old grandpa on his original ipad.

Not to mention .io is way more expensive, unless you have some very specific reason to use .io I don't understand the appeal for something that is aimed at normies.

what's the reason, when you can just use extra padding on existing elements themselves, instead of inserting additional elements for that?
do you have an example

>what's the reason, when you can just use extra padding on existing elements themselves
but then I'd have to duplicate them and hide them depending on the breakpoint

no, you use media queries to change the styling of the same element

jsfiddle.net/mznkexb8/6/
make the output window bigger/smaller and you will see

This thread better not get archived tonight

What do you do after you finish a big project?

/wdg/ is so dead lately

So I'm wondering how I should handle oauth2.
I have a restful api server that uses JWT tokens and a vue.js frontend.
Should I have a callback in my api server for oauth2 then issue a jwt token?

ya

Thanks just double checking

I wish I have Backend Dev interview in2 week's

I pine for the days when I was backend only...

Working on my personal website using bootstrap 4.

I had this idea of making the sidebar kind of narrow on the side, then move down to the bottom when the screen gets smaller.

I want the elements to be stacked like pic related when the sidebar is on the side, then spread out to inline elements when the sidebar moves to the bottom of the screen. How would i go about doing that? I'm used to making elements horizontal as the screen is larger and making them stack vertically as the screen gets smaller, but not the other way around. I don't know how to use the bootstrap grid to do that, perhaps using CSS flexbox/grid I can do something like that (still kind of new to that)

Would it even be a good idea though? I guess i can just stack them all up vertically and center them, then move them to the bottom of the screen in the same configuration when the screen gets smaller. That would definitely be easier, but I think it would really cool if I could pull off making the sidebar stretch across the screen at the bottom on mobile devices and display the contact items horizontally.

Use flex-wrap, and just treat them normally. When it moves to the footer, it will gain a bunch of width and cause them to line up. Make sure the parent is flex-direction row.

Same, but only because I hate CSS.

>Now a recruiter called me about a gun ecommerce site job. Anyone have experience with that? The pay is double which puts me at the household average income of that area. Any idea if ecommerce companies are chill? Like really not all that much work to do on a functional site, right?

Literally my dream is to do web development for a gun company or a gun site so I can get free or cheap gats. Fucking do it man. You'd be living my dream.

Live not too far from the Beretta USA and Benelli USA plants.

This is so fucking American, next you'll say your second best option is working on the McDonald's site

I'm a simple man: Guns, Vidya and Internet. If I can combine two of those things I'm golden.

just learn java faggot

>who the fuck does backend in python?
stackshare.io/python/in-stacks

How does one go about successfully making a post to Sup Forums programatically? When I send the http request, the http response indicates code 200, however no post is made. Captcha sent and everything. What am I doing wrong?

>Terraform
I've been meaning to look at it. How many virtual servers do you manage? Does it help with blue/green deployments?

I currently use Ansible and Vagrant for provisioning, but I am thinking of switching to Docker and hyper.sh/ or something equivalent to not have to manage infrastructure directly.

Venezuelan in need of hard currency here. I know basic "Programming I" shit, what's the fastest road to getting freelance work?

Perl, Python or PHP as a CGI and why?
At the moment I'm not too excited to learn PHP but will approach if there's a good reason to. More leaning towards Perl at the moment. Thanks.

Totally depends on the use case.

Developing a web stack to practice exploiting and securing, wanting something dynamic that I can get a good level of security training out of.