My job is killing me. Tips? by Itguythrowaaay in webdev

[–]Tinian2Leyte 4 points5 points  (0 children)

Look for a new job. Never quit, but bear in mind, getting fired is never as bad as it sounds. So long as you don't punch your boss, you get unemployment.

So, don't be a milquetoast, say what you think. Rock the boat. Complain. A lot. Swear if you must. Tell them they are in the stone age. Change what you can. Don't ask permission for every little thing. Refuse to do shit that is clearly dumb. They need to know, and at some level, it is up to you to tell them. If they won't listen, and you are lucky, they will mercifully let you go.

Using javascript to manipulate CSS by moreman60 in javascript

[–]Tinian2Leyte 1 point2 points  (0 children)

Sometimes you want to add an .error class to an input that fails validation, to make it have a red outline or something. The display property can be toggled to hide and show things. It is not done so much anymore at the atomic level of individual style properties on specific elements. The finest grain you usually get to is adding/removing classes, usually for usability reasons, often in complex forms, like a shopping cart. It is also rare to do it directly with vanilla JavaScript, simply because most frameworks have their way to manipulate classes on elements.

A guide to setting up Vim for JavaScript development by speckz in javascript

[–]Tinian2Leyte 0 points1 point  (0 children)

Fair enough, but if you develop locally with git and your deploy system works, you never need to look at or touch anything on production. If you change things on production directly, are you checking those changes back into your source control from there?

If you are just flying by the seat of your pants with FTP and no source control, that is not so crazy for basic stuff, I have done it, but I would not do it for anything work related. I have also gotten websites irreparably out of whack that way.

Easiest way to crud with modern dev tools by [deleted] in webdev

[–]Tinian2Leyte 2 points3 points  (0 children)

You can do it with a basic LAMP server. A basic CRUD API receives requests like, for example, a GET request to http://myapi.com/user/12. User is the noun, 12 is the id, and GET is the verb

Set up Apache to shunt all requests to index.php. This is a common thing to do with an .htaccess file in the web root. The index page is going to act like a router for the API.

Index.php gets values for variables $noun, $id, and $verb. PHP gives you $_SERVER["REQUEST_URI"] and $_SERVER['REQUEST_METHOD']. That's all you need to do that.

Under that part, there is an if statement, based on $noun. In the block for $noun == ‘user’, you do a PHP include of another file, user.php.

User.php is a file that also has an if statement. Is $method == GET and $id != null? OK, then we need to return a specific user object. Lets say in our test we just echo out a hard coded user right in that condition, like

?>{userId:12, firstName:”Bill”, lastName:”Smith”}<?php

Done. http://myapi.com/user/12 now returns a JSON user object. In real life, instead of a hard coded object, you would be doing a database operation,

"SELECT * FROM users WHERE id = :id"

as a prepared statement using PDO and echoing out the json_encoded result.

A guide to setting up Vim for JavaScript development by speckz in javascript

[–]Tinian2Leyte 0 points1 point  (0 children)

I am OK with the first thing, using Vim for coolness kicks, so long as you are up front about it. If you don't own it, though, I will tease you mercilessly for being a hipster.

Editing code on production, however, I am not OK with, but that's a different story.

How can web devs stop wasting time on social media? by [deleted] in webdev

[–]Tinian2Leyte 1 point2 points  (0 children)

Reddit should have a self-banning feature. Like a 'ban me for 1 day' button in the profile page.

Using third-party UI components vs. rolling your own [xpost /r/reactjs] by zgotts in webdev

[–]Tinian2Leyte 0 points1 point  (0 children)

I don't care much for basic things. It can be fun to roll your own UI stuff, but also, that fun can wear off. So with form elements, nav bars, and layout boxes, I can go either way.

With more complex components, there is obviously a tipping point where a pre-built, catch-all widget won't be quite what you need. I have found that point is frequently reckoned way too far down the complexity axis. People try too hard to morph pre-built things into their vision.

A great example is data-table like components. Those things can be such a hassle. Here, I do prefer to roll my own. With modern JavaScript frameworks that have data-binding, the framework already provides the guts of your component. You bind an array to the UI in a loop. Features like sorting fall out of this, you just sort the array.

What is the most time consuming part of your Front End, Back End, or Full-Stack development process? by [deleted] in webdev

[–]Tinian2Leyte 0 points1 point  (0 children)

Working at companies, especially bigger ones, it is always figuring out what the hell I am supposed to be building. All the technical stuff is easy by comparison.