/wdg/ - Web Development General

THE ABSOLUTE STATE OF /wdg/ EDITION

>Discord
discord.gg/wdg

>IRC Channel
#Sup Forumswdg @ irc.rizon.net
Web client: rizon.net/chat

>Learning material
codecademy.com/
bento.io/
programming-motherfucker.com/
github.com/vhf/free-programming-books/blob/master/free-programming-books.md
theodinproject.com/
freecodecamp.com/
w3schools.com/
developer.mozilla.org/
codewars.com/

>Useful Youtube channels
derekbanas
thenewboston
learncodeacademy
funfunfunction
computerphile
codingrainbow

>Frontend development
github.com/dypsilon/frontend-dev-bookmarks

>Backend development
en.wikipedia.org/wiki/Comparison_of_web_application_frameworks
[Gist] backendDevelopmentBookmarks.md

>Useful tools
pastebin.com/q5nB1Npt/
libraries.io/ - Discover new open source libraries, modules and frameworks and keep track of ones you depend upon.
developer.mozilla.org/en-US/docs/Web - Guides for HTML, CSS, JS, Web APIs & more.
programmableweb.com/ - List of public APIs

>NEET guide to web dev employment
pastebin.com/4YeJAUbT/

>How to get started
pastebin.com/pDT82mQS
pastebin.com/AL6j7GEE

>cheap vps hosting in most western locations
lowendbox.com
digitalocean.com/
linode.com/
heroku.com/
leaseweb.com

Other urls found in this thread:

redditblog.com/2017/04/13/how-we-built-rplace/
${host}:${port}`);
api.coinmarketcap.com/v1/ticker/').json()
api.coinmarketcap.com/v1/ticker/',
npmjs.com/package/node-fetch
api.coinmarketcap.com/v1/ticker/')
github.com/afarkas/html5shiv
motherfuckingwebsite.com/
bettermotherfuckingwebsite.com/
thebestmotherfucking.website/
lingscars.com/
api.jquery.com/on/#on-events-selector-data
twitter.com/NSFWRedditImage

First for PHP

we should let this general die tbhfam.
anyway, why does everyone recommend this piece of shit of an IDE for php? i tried it today and it cant even make $_POST to work. i looked in their forums and people were complaining for the same and no one answers LMAO

>it cant even make $_POST to work

That is a hugely broad statement. What exactly do you mean?

Why would I use VS code instead of Visual Studio?

We just got off work. Chill.

I'm in my daily traffic bullshit still.

$_POST is empty all the fucking time. probably have to tweak the shitty IDE that everyone drools over.
in the meantime i am testing my shit manually (and it works there obviously)

Read this shit.

redditblog.com/2017/04/13/how-we-built-rplace/

whats wrong with typescript?
from what i've seen it seems really good but there are very few projects that use it
only problem was being slightly hard to integrate with existing code

TLDR: Swift developer here, haven't used Node in half or so, trying to set up an Express app that serves JSON from mongodb but instead of valid JSON I get an empty array. Help me /wdg/...
Model:
const mongoose = require("mongoose");

const Schema = mongoose.Schema;

const schema = new Schema({
date: String
}, {
collection: 'importantDates'
});

schema.set("collection", "importantDates");

module.exports = mongoose.model("date", schema);
Router:
const express = require('express');
const router = express.Router();
const Date = require('../models/date');

router.route("/dates").get((req, res) => {
Date.find((err, date) => {
if(err) {
res.send(err);
} else {
res.json(date);
console.log(date);
}
})
});

module.exports = router;

App/server:
const express = require('express');
const app = express();
let json = require('./users.json');
const mongoose = require('mongoose');
const db = require('./db/config');
mongoose.connect(db.url);
const router = require('./router/router');
let databaseConnection = mongoose.connection;
const bodyParser = require('body-parser');

app.get('/listUsers', (req, res) => {
res.json(json)
});

app.use(bodyParser.urlencoded({extended: true}));

app.use(bodyParser.json());

app.use('/', router);

databaseConnection.once('open', () => {
console.log("Connected to Mongodb");
});

const server = app.listen(3000, () => {

let host = '127.0.0.1';
let port = process.env.PORT || 3000
console.log(`app listening on ${host}:${port}`);
});
This code used to work before, now it doesn't. The name of my one and only collection is 'importantDates', haven't touched javascript and node for a while. Roodypoo...

half a year or so*

Huh, apparently the unpkg cdn has started redirecting to malware. That's kinda not good...

What sites should .moe be used on?

anything that's moe

amazing

Hello

I'm making a program to circumvent some non-free javascript that you have to use to get into the wifi on the new york subway

Yes, I know how autistic that is

Can anyone tell me were to start?

I have a website. It's cheap and run off of bluehost for 200 bucks for every 2 years.

Can I make it so every email directed to [email protected] goes to my gmail account?

Yeah, that should be an option through your registrar's admin console.

I have a React app which loads super fucking slow because I'm transpiling the JSX with Browser.js on page load. What are some best practices/packages for frontend production builds?

Working on a personal project over here and I just came up with this abomination of a regex:
/,(?=[\w$@,:/.!?*\\;+\-\> ]*(?=(\([\w$@,\-\>!?*\\.;+/: ]*\)|\$(?!.*\)))))/g

/*It searches for commas outside of parentheses so you can parse parent-child tag relations like:
@$franchise:Fate->($series:Fate/Grand Order,$series:Fate/Apocrypha),@$series:Fate/Grand Order->($character:Rider of Black,$character:Fujimaru Ritsuka),@$character:Rider of Black->($gender:male,$male:fang,$male:pink hair,$male:side ponytail,$male:heart-shaped pupils,$male:tomgirl,$male:otoko no ko),$language:None,@$character:Fujimaru Ritsuka->($gender:female,$female:embarassment)
and only capture legitimate commas so that we can parse the p-c tag relationships for later.
*/


I wish JS had real positive and negative lookbehinds. It would make coming up with my autistic tagging system much easier.

How do you rewrite URLs these days? Still with mid_rewrite?

nvm solved my problem. fuck you /wdg/

Does anyone know Lineode's current CPU frequency?

I'm got a Vultr VPS and while the SSD and network performance is satisfactory, the CPU is at a meager 2.3 GHz

I cant drop the imposter syndrome.

I compare myself to the other devs constantly.

There's one guy that will start saying 'wtf are you fucking serious' to his monitor then 30 secomds later my code review is denied by him.

Fuck this framework, man. it's like getting a job in HTML/CSS and they make you use Dreamweaver in Chinese.

I want to code in the language, not dig through 200 classes looking for a method to use instead. Is this shit normal in this industry?

create-react-app

Move away from frontend development

I'm backend.

I think I need to do startups.

yes bruh, this is the current state in 2017. everybody wants to use bleeding edge frameworks so you're gonna have to buckle up buddy.

but at the end of the day just remember all these motherfuckers are nerds.

Not that guy but that's definitely a reason to consider PHP. It only gets better and as long you don't mind the meme kiddos it's petty comfy.

for comfort php is fine, but for growth i think learning javascript + frameworks will have a much better return.

say what you want, but javascript is here to stay. look at electron.js, took the web stack to make native apps.

So I have this form that contains blocks of text form a webpage. It is built dynamically depending what types of elements are being displayed on the webpage. When I post this is the array that I get back.

{"_token":"Token","pageName":"index","1":"Hello this is the first block of text.","2":"This is the second block of text.","3":"This is the third block of text.","4":"This is the last block of text.","metaTags":"some tags"}


how can I figure out how many dynamic elements I have on my webpage so I know how to post them to my database. should I just make a hidden field on my webpage I feel like a user could just fuck with that and end up braking my page or my database.

What are some cheap webhosts for a tiny PHP project?

put the dynamic stuff into an indexed array within your existing array.

{
current_array_stuff,
indexed_array: [ '0':'a' , '1':'b', ...]
}

> A variable is empty because you don't know how to use an IDE.

Sup Forums retards everyone

This

why do some people ommit semicolons; on es6 ?
Are semicolons now optional on es6?

I've seen some
import {poo} from "loo"

instead of
import {poo} from "loo";

I'm a CS student so I know some programming. Picked up a little bit of Jvascript along the way and I can understand what HTML is doing for the most part.

My goal is to setup my own website where I can mess around and practice my skills. How is this typically done?

Been learning a bit of JS recently to help with a page on my site. I thought as a bit of practice I'd convert a small Python script I made into JavaScript. It just calls the coinmarketcap API to get cryptocurrency prices.

In Python calling an API is as easy as
requests.get('api.coinmarketcap.com/v1/ticker/').json()

I can't seem to get this same functionality using Node. I used the request library but it seems a bit obtuse.

request('api.coinmarketcap.com/v1/ticker/', function(error, response, body) {
if (!error && response.statusCode == 200) {
console.log(body);
}
})

This works and prints the body to stdout but I can't find a way to assign the JSON body to a variable so I can parse it. I can only assign the request information. Is there a simpler library that acts more like curl?

ok I 'solved' it.

request(options, function(error, response, body) {
if (!error && response.statusCode == 200) {
for (var i = 0; i < body.length; i++) {
if (coin == body[i].id || coin == body[i].symbol) {
console.log(body[i].price_usd);
}
}
}
})

So the function is a callback function and the result of the request is piped into it? Is this style common in JS? Does this mean that all processing of the API has to be done within this callback function?

So I have a site where people can search compromised data. It can output millions of results in mere seconds, searching through over 3 billion rows. Is there any logical limit I should set to the amount of output on the page? For example at which point will chrome/firefox crash because of the large amounts of results. Each result on avg uses a little less than 1000px and 0.1KB. I have a pretty top-of-the-line computer, and if I search Jon* with wildcard my browser ends up slowing to a halt for a few seconds before quickly displaying more and more data for up to 10-20 seconds locally in the browser.

Should I limit it at all? Won't js-based pagination have the same issue?

Meant 200px*

Rendering all the output data at once can take a hit on the browser, js-based pagination can reduce it a little bit if you just load the data to memory and you render it later with js.

From my experience the best approach is to do server side filtering if all the records are more than 5-8MB each time you call it, meaning all you need to do on the front end is rendering the result and figure out how to paginate.

I'm trying to put together a page which has an image with a link to the full size image when you click on it. At the bottom of the image, I want a link that can toggle the image and link to the new images full size.

I've got the page set up as a table, the image set as a background image in css for that particular cell (which for me, makes it easier to manage the template).

I'm pretty sure I can use css' :target selector for this, but I'm unsure what I can do to have the original image displayed initially. If possible, how would I implement this to switch between more than two images?

To show in code:

td#imagea
{
background-size: 800px;
width: 800px;
height: 614px;
background-image: url("imagea");
background-repeat: no-repeat;
border: 1px solid white;
}






/*code here to toggle image a to image b and change the link from imagea to imageb */

For those interested:

I want to make a website with photo galleries and events schedules for different cities. It should have custom cms for employees to load content weekly. What would be a good choice of tech for something like that in 201x?

just use a cms, wordpress is always a good choice

It's not es6 but yes, semicolons are optional. The compiler automatically adds them in where it thinks they're supposed to be when the script gets JITted.

>So the function is a callback function and the result of the request is piped into it?
You can think of it that way. Node tells your OS to do the HTTP request and then when it gets the response back, it passes it calls the callback function, passing in the response data.

>Does this mean that all processing of the API has to be done within this callback function?
Yes, you can't do anything with the response data until the server you're trying to contact sends it to you.

>Is this style common in JS?
Yes. It's a common pattern for dealing with asynchronous code in Node. Otherwise, it would have to block until the HTTP response came back, which would take way too long. Most of the time Node devs use Promises or Async/Await which are syntactic sugar over callbacks and make the code a lot cleaner. (Promise API is built in as of node 4.something and Async/Await as of node 7.6 or so) You could look into modifying your code to use one of those patterns or find a different package that has it built in. I usually use npmjs.com/package/node-fetch which works like the browser's fetch API. You'd use it something like this:
const fetch = require('node-fetch') // npm i -S node-fetch
fetch('api.coinmarketcap.com/v1/ticker/')
.then(response => response.json()) // parse body as json
.then(json => {
console.log(json) // or parse the json and do whatever with it
})
.catch(e => console.log(e)) // handle any errors

How can I configure nginx to make proxy_pass on example.com/ and show local file from root directory on example.com/somefile?

tell me anons, is this good way of writing php code

jesus christ how horrifying

So I start college in the fall because I don't have the balls to join the military. Doing their IT program and my options for electives is Web Dev 1, 2 and an advanced course otherwise I choose Java or some other useless shit with Excel.

My question is how is web development? I fucked around with code academy for a day and I enjoyed it, seemed fun. How is the pay in that area? How hard was it to find a job in the first place? How's the demand? Thanks in advance.

w-why user

Assuming you already have a local nginx config file set up, it'll look a little something like this:

upstream your_file {
server host/port/socket;
}

server {
listen 80;
#etc
server_name example.com;
root /path/to/root;

location / {
# default settings
}

location /somefile {
alias /path/to/your/file;
proxy_pass your_file;
include /path/to/proxy_params;
# proxy_set_header scheme;
}
}

Actually if it's all in your root dir you may only need location / rather than /somefile.

So, my wannabe-nazi-but-actually-gay friend gave my contact info away to a 40-year-old turbonazi under the premise of creating a stupid website, but who I'm very afraid of and now I'm afraid for my life.

Would you:
>create a very simple website with a single HTML form which sends an e-mail after submission
>or decline to work for the mafia guy

Which option gets you (me) less crippled/killed/sleeping-with-the-fishes/etc?

Well, show your code.

Lightweight, multiplatform, multilanguage. VS is better but only for .NET.

Why did you create a class to do that instead of just a function? Why are you accessing a superglobal ($_GET) inside the function instead of passing it as an argument?


Not a PHP guy so excuse any syntax errors, but if you're going to do it OOP style, it should generally look like this:



Here's your fuckin filesize, dumbass:

Or, if you don't want to do any other bullshit with the file object, just use a function:

// /somepage.php?video=how_to_kill_yourself




Here's your fuckin filesize, dumbass:

I'm confused. Is he a mafioso or a Nazi?

If he's a Nazi just make a few bucks off of him on yet another white pride website. Nazis are pretty tame.

If he's a legit mafioso then wtf does he want a website for? Anyway in the mafioso case it could lead to lucrative work if you do well. On the other hand it could lead to work you might not be comfortable with. Eventually they're going to want you to hack something.

Both. I think it's a Russian mafia kind of deal where they hate all foreigners by default (except slavs I guess).

The website is some delivery business thing but I think eventually it will be a tax fraud or body disposal thing (strong guessing).

Are MIME and RFC822 used together? Or are they different from each other? What do they each do?

Using a class is overkill for such a simple task especially since it only has one method. Don't fall for the OO meme.

Using $_GET['video'] inside the class means you won't be able to use that class unless $_GET['video'] is available, which defeats the purpose of reusability. Just pass it the filename as an argument instead.

Return the size instead of printing it out. The user may need to apply modifications to it before displaying it.

Maybe use absolute paths instead of relative ones, just a preference.

As far as security is concerned : what I would be concerned about is LFI. Forcing a .webm extension should already do the trick, but just to be sure check to see if 'COMPRESSED_' . basename($video) . '.webm' is inside the 'uploads/' dir. There's not much the user can do with the size of a file (maybe combine it with another attack and see if a specific file was modified as a result, it can be deduced from consecutive calls to filesize) but it's better to be paranoid.

How do websites store captive portal credentials?

Make the website. Make it real good, Ivan. If you have any other skills don't let them know unless you want to sell a service to them.

angular2 reading material ?

>At home
Building cool and unique shit from scratch. Launching cool things
>At work
Answer customer questions about how numbers are generated.
Copy and paste someone elses work from 3 years ago when someone wants it. Still gets denied by review-nazis.

I'm a copy and paste mathmetician at this point and I hate it.

Where do I get to dev?

How much backwards compatibility do you need to consider when web deving? I'm just mucking about with an html file, and my css is not loading in IE8. Should I care?

if you have a lot of IE8 users, sure.
though I'd find it weird that it wouldn't load just in IE8, since there should be no difference when loading css files in a newer browser.

ah it was just because I was using a tag, I guess ie8 doesnt understand it. Is the safe way to make everything a etc then?

github.com/afarkas/html5shiv
will make it recognize newer tags.

at work at least we generally target IE9+ or sometimes even only IE11.
Some legacy applications, or those we know IE8 is still required, we keep it compatible but display a warning on top that visual glitches might appear.

For my bachelor end project, I need to make a graph editing website where people can draw and make graphs. So they can be tested on certain algorithms n sheeet. Their actions also have to be logged when they create certain graphs.

Should I use Canvas, and then JCanvas? Or are there other techniques like SVG more suited?

Backend will probably be in ASP.

thanks bud

Anybody ever use Magento? I'm having an issue with scope, calling a function on a product block on the search results. Within the block I call a function that addresses that block's SKU, but it's pulling the first SKU on the page instead of the one within the block.

I've managed to force functionality by injecting the SKU into the function name within the block, but this is hack as fuck. What do?

post good simple website design besides these
motherfuckingwebsite.com/
bettermotherfuckingwebsite.com/
thebestmotherfucking.website/

lingscars.com/

I'm developing a javascript script that is distributed not through a website

I want to request a webpage and send things to it from this javascript script

problem is I'm getting fucked by this "same origin poolicy" shit.

Can't I run a JS script as an admin to get it to stop sandboxing me like that?

if my website looks nice and works on my brows when it is minimized as small as possible, can i assume it will look just as good on any mobile device? I dont want to check how it looks on my phone every 10 minutes

press the mobile preview button in your browsers dev console.

You can fuck with some browsers security options to bypass same origin policy. However, that won't really work in production.

One option is to serve the script through a local nodeJS instance that act as a proxy for your requests.

If you control the server sending the data, you can fuck with CORS headers to allow it.

>Can't I run a JS script as an admin to get it to stop sandboxing me like that?
Not really, the entire point of having it is to help prevent cross-site scripting attacks/.

You probably want to use a web scraper or just curl though.

>he's not an asynchronous developer

So, is there a web framework that is not actually shit? I mean, one that Sup Forums can unironically recommend?

I recently used angularJS with NodeJS and it wasn't a fun experience. Honestly, I felt more productive in vanilla javascript.

I usually work deep in the backend, but I decided to start doing some front end stuff for shit and giggles.

Vue is pretty comfy.

The Discord invite link doesn't work

Is freecodecamp legit and worth putting on your resume?

i have some jquery in doc ready that selects all text in the input fields onfocus. It works when you first load the page but after you do other stuff on the page which does some ajax requests, that input select all jquery code stops working

what do?

do you append the elements dynamically?
how should we know when you don't post any code?

>i felt more productive using vanilla javascript

thats because youre using the actual base language instead of meme frameworks built on top of it. Hence why I despise .net developers so much. They think theyre some hot shot by letting M$ cuck them into thinking theyre shit is the holier than thou way to go. You rarely see poo in the loo's program in something other than .net/c# because M$ sends millions of dollars of .net resources to the almighty poo in the loo nation, India.

yea i am

$("#searchInput input:text, #replacement_num, .tracking_num, .item_num").focus(function() { $(this).select(); } );

I'm trying to write a script to connect to McDonalds wifi in python with basic HTTP requests

I cannot use their captive portal because I'm gonna run this on a raspberry pi which does not support their javascript. It only has http GET/POST from the python requests library

I need to know: How do I figure out what data McDonalds wants me to send them to get past the captive portal?

>Is freecodecamp legit
yes

>worth putting on your resume
no

It's a good jumping off point, but ultimately you need to make things on your own if you want to git gud.

I use atom and xaamp to work on my ideas, or to try and replicate other sites for practice. I use firecuck and the chromebot to test my work

t. loser newfag that wasted his life and is dumb enough to try and salvage what's left of it.

Is it just a meme that you can make money as a freelance webdev? I always see articles about how programmers are the most in demand position and it's not like there's going to be any less demand for coders as long as the internet exists

well, since the script only runs once on document ready, it does not add the events to inputs added later.
use on
api.jquery.com/on/#on-events-selector-data
and add the event to the container of your elements with your css selectors as filter.

if youre truly good at something and the motivation is there, you can make money, yes. Economics 101

actually you dont even need to be good at whatever it is sometimes to make money

I haven't used it in a while, but I've done a number of WordPress installs for people. It's comfy for someone like me who isn't/wasn't smart enough for drupal

So back in the days when CGI was the norm how were applications organized? I guess this applies to PHP too, but lets say you have a static html contact page, and the backend that processes it. its wasteful to have PHP parse the static file or have a cgi script spit out static html but its also a headache to seperate into different folders with static assets?

Charge $350-$750 depending on where you live. Do a good job.

still doesnt work for the dynamically added inputs

$("#searchInput input:text, #replacement_num, .tracking_num, .item_num").on("focus", function() { $(this).select(); });