[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
/wdg/ - Web Development General
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 255
Thread images: 25
File: bigguy.jpg (89 KB, 670x1000) Image search: [Google]
bigguy.jpg
89 KB, 670x1000
Crockford Edition

Previous Thread: >>54664732

>IRC Channel
#/g/wdg @ irc.rizon.net
Web client: https://www.rizon.net/chat

> Discord
https://discord.gg/0qLTzz5potDFXfdT

>Learning material
https://www.codecademy.com/
https://www.bento.io/
https://programming-motherfucker.com/
https://github.com/vhf/free-programming-books/blob/master/free-programming-books.md
https://www.theodinproject.com/
https://www.freecodecamp.com/
http://www.w3schools.com/
https://developer.mozilla.org/
http://www.codewars.com/
https://youtu.be/JxAXlJEmNMg?list=PL7664379246A246CB - "Crockford on JavaScript" lecture series.

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

>Backend development
https://en.m.wikipedia.org/wiki/Comparison_of_web_application_frameworks
https://gist.github.com/dypsilon/5819528/

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

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

>How to get started
https://youtu.be/pB0WvcxTbCA - "WATCH THIS IF YOU WANT TO BECOME A WEB DEVELOPER! - Web Development Career advice"
https://youtu.be/zf_cb_Nw5zY - "JavaScript is Easy" - If you can't into programming, you probably won't find a simpler introduction to JavaScript than this.

>cheap vps hosting in most western locations
https://lowendbox.com
https://www.digitalocean.com/
https://www.linode.com/
https://www.heroku.com/
https://www.leaseweb.com
>>
First for TypeScript scales better.
>>
$("#haters").fadeOut;
>>
File: SASS-CSS.jpg (65 KB, 555x269) Image search: [Google]
SASS-CSS.jpg
65 KB, 555x269
If somebody could write a sublime-text plugin for automatically generating CSS from SASS in realtime I'd give it 500 stars on github. pic related.
I badly need that shit.
>>
>>54680773
how much would you be willing to pay?
>>
>>54680773
this is probably your best bet
http://www.sassmeister.com/
>>
>>54681396
Awesome! thanks!
SASS > LESS
>>
Wtf does "spinning a wev server" mean??
>>
>>54682786
wut

Do you mean "spinning UP a web server"? That just means provisioning a server with a typical web stack - the http server (nginx or apache usually), a backend language interpreter (node, python, php, ruby etc.) and often a DB (mysql most of the time).
>>
>>54682891
I worked on some pong game in canvas and realized how much more fun it is compared to developing generic crud web apps. Damn.
>>
Which linter do you use for Javascript?

I used to use JSLint but now I use ESLint with most of the rules turned on.

If you don't use a linter, and a strict linter, then you're bad and you should feel bad.
>>
>>54680773

That picture is kinda stupid.

You can see how he rearranged the CSS so that it looks "terrible", when in fact the code is pretty similar, just a littel bit longer.
>>
>>54683184
Why should i use a linter?
>>
Do i need a bs degree to even be considered for a web dev position?
>>
What do interviewers consider "expierence"? Im somewhat ashamed to post my github out of fear that they might laugh at my hobby projects. Whay am i such a beta?
>>
>>54683256
What? This is no comparison picture trying to prove SASS is superior to CSS. It's just an example of what compiled SASS looks like (uncompressed).
The CSS wasn't rearranged to look "terrible" either, indenting related blocks is common practice to aid readability.
>>
>>54683969
Sass is redundant bullshit for hipsters
Just like coffeescript
>>
>>54683996
no.
changing the entire color theme of a page with one variable change is pretty handy.
you can't do that with CSS (yet).

inheritance is amazing too, I don't want without anymore.
>>
>>54683863
>What do interviewers consider "expierence"?

You could just try a few interviews and see what happens. If your github is fine, you may get a job. And if it's not, you have your answer.
>>
>>54684048
I don't even have github and I only have some trivial web apps and some html+css only web designs. I have no idea what is worth having on there in 2016. Should I be worried and how to fix it? My projects can show knowledge of responsive design, principles of graphic and web design, Wordpress and making custom themes, some PHP and some JS/jQ/Angular but it is pretty basic (~100 loc max.).
>>
>>54680145
>>54680159
>>54680580
>>54680773
>>54680858
>>54681396
>>54681538
>>54682786
>>54682850
>>54683164
>>54683184
>>54683256
>>54683841
>>54683852
>>54683863
>>54683969
>>54683996
>>54684019
>>54684048
>>54684284

Array.from(document.getElementsByClassName('postContainer')).map(post => `>>${post.id.substring(2)}`).join('\n')
>>
>>54683852
No, but it certainly gives an advantage, at least in the beginning. There is huge difference between no experience and degree, and just no experience. Also there are some (mainly corporate) jobs where degree is automatic requirement.
>>
Does anyone know a registrar where you can upload your own html parking page for your domain?

Two step verification would be a plus.
>>
>>54684806
https://www.gandi.net/domain/basekit
not sure if you can use your own page though or if it's just a wysiwyg type page.
>>
>>54684888
Gandi uses a wysiwyg editor with a handful of templates. It's second best.
>>
I know this gets asked a lot but what does /g/ use as an editor? I've tried Sublime 2 and Brackets, both have minor issues that bug me so I'm looking for something else. Is Sublime 3 any better?
>>
>>54684942
visual studio/atom for multiple files, notepad2 for single files.
>>
>>54684942
I use Notepad++ for Windows and Atom for Linux.
>>
Guys what REST frameworks offer good performance while maintaining decent levels of functionality? My company uses Django REST now but it's performance really falls short when things get too complex. We have objects with around 20 different relations and we are looking at API response times of about 400ms for one of them. When somebody wants to fetch more then one then it's obviously a disaster. Caching possibilities are also limited as those objects adapt to current user permissions etc. Slicing them does not help the total wait time either. Any suggestions? It's not the first time Django REST failed us and we are looking for something snappier without reinventing the wheel. Good support for postgis would be an added bonus.
>>
Bringing this up again for tips. >>54677754
Am I the only one finding it damn near impossible to even get a callback or interview? I feel like I'm being rejected for some other reason than my qualifications. I have a pretty weird name, that must be it right?
I've had my resume and cover letter vetted by the Career Services department of my college and they've given me great tips to make them near perfect. I've sent out over 30 applications online and the most I've gotten so far in the last 3 months is automated email responses and rejections stating they've chosen to pursue other candidates. I feel like giving up despite web dev being my passion, because technically I'm qualified to work in other areas such as Networking, Sys Admin, Tech Support, etc. but none of those areas makes me happy.
>>
>>54680145

>javascript
>over the age of 25

How sad.
>>
File: 1447449518488.webm (1 MB, 640x360) Image search: [Google]
1447449518488.webm
1 MB, 640x360
>>54685205
You're just another webdev in a sea of endless webdevs. I don't want to discourage you, but you probably aren't going to get a response by just sending out resumes. You need to network with people, talk to peers/family who work at large companies and see if they are looking for someone like you. Employers would rather hire someone who has connections in their offices than spend hundreds/thousands of dollars advertising their position
>>
>>54685205
Same as me except I'm 27.

So it's not age.

My theory is they see 2 projects on the github and bail without reading what they do.

Like I have a free installable geolocations API that could reduce costs on every dating and social media website so they could operate feasibly operate primarily under an ad-based monetization that would bring in more viewers than a "pay-to-message" scheme.

Not 1 email.

I should probably just template a wordpress website with lorem ipsum and would land a job in 2 hours.
>>
>>54685225
>implying javascript is acceptable at any age
>>
>>54685205
Are you looking for an internship or a junior dev position?
I got my first internship a month ago just by emailing the CEO of a pretty small web agency. My CV was pretty mediocre and I had only done 4 projects on github, 2 of them being related to the internship I got.
>>
>>54685259
>Employers would rather hire someone who has connections in their offices than spend hundreds/thousands of dollars advertising their position
But a lot of them actually do advertise. I don't send out random resumes, I've only applied to open positions I come across on sites like Monster, Indeed, etc. I guess you're right though, there are probably a few good positions available that are being filled through connections without even advertising. It sucks because I love web dev more than any other area. I've seen positions being advertised with salaries well over 100k, little do they know I'd take a third of that and still be happier than most being paid in full. I will see how best I can network.

>>54685311
That sounds like a great project and it's a shame you haven't gotten more opportunities based on that. I guess we're in the same boat, although my projects are not as complex. Funny thing is though, I've actually started making a WP website in an attempt to branch out.

>>54685394
A junior dev position would be great, but I'd take an internship as well - just to get started in the field. I'll try to do the same thing by emailing a few of the smaller web startups. Thanks for the tip.
>>
"Javascript... JavaScript I actually like. I like that language. I don't program in it of course, because I'm a real man."

- Linus Torvalds

Actual quote.
>>
>>54685519

>WIMMIN BTFO
>SJWs ON SUICIDE WATCH
>>
http://wahl16.bmi.gv.at/
52/48 fugggggg
>>
>>54685877
nur die Ruhe, das wird noch.
>>
>>54683841
Because Javascript is "beginner friendly" meaning that it will let you be a complete retard.

So you need a tool that can enforce code quality and style, and prevent stupi errors from arising.
>>
>>54684534
Thanks for the (You) I guess.
>>
Can someone explain to my how is it that, if you disable javascript on your browser, lots of websites with interactive features still function somewhat normally?

What other web development languages are there that allow to make interactive web applications? I mean other than ASP.
>>
>>54686085
Because its possible to do a lot with just HTML and CSS and design a site to fail gracefully or still be usable while JS is off.

This is generally good practice because everybody has Javascript off when the page is still loading.

>What other web development languages are there that allow to make interactive web applications? I mean other than ASP.

Literally anything. But Javascript is the only langauge that can currently provide fancy functionality in the browser itself
>>
>>54685492
>I've actually started making a WP website in an attempt to branch out.
Same, and I really hate WP.

It's nice to know that I am not the only one suffering this job market atm.
>>
>>54686085
There isn't one. What you're seeing is good CSS and forms submitting shit without using AJAX, at best.
>>
>>54686085
I always make my sites function with PHP alone, then use javascript purely for cosmetic reasons afterwards. Though sometimes I NEED to use JS to populate some pages, I avoid it whenever possible

in all honesty I don't know if what i'm doing is bad practice or not, but i haven't had any trouble
>>
>>54686153
>good CSS
Can you give me an example of what CSS can do in that field?
>>
>>54685037
Do you already know what part of your service is causing the slowdown?

Anyway, I recommend servant, a REST framework for Haskell. For database accesses, persistent is a successful library.
>>
>>54684958
Why not Atom for Windows too?
>>
So I'm still new to Webdev, and I've been trying to use DRY as well as shorter functions.

For instance, I have it so when you do a POST request to /login, it will call a function that will find your username and check if your password is correct.

I know that nesting/callbacks can be a problem in node, and I was wondering how many nests deep I should go, before I should use call another function? Or would that cause problems?
>>
>>54686560
>I know that nesting/callbacks can be a problem in node

Use promises, generators, or async-await.

There's no reason to put up with nested callbacks anymore.
>>
Anyone remember the ridiculous doctypes from the 90's?

Now we just have !DOCTYPE html

how nice.
>>
Should you indent the head and body tags since they are nested in <html> or no?
>>
>>54686969
Doesn't really matter.

I nest mine, but some people don't
>>
>>54686969
it doesn't really matter or change anything.
I do it because I feel better if I do.
>>
File: 1458708215534.png (392 KB, 540x587) Image search: [Google]
1458708215534.png
392 KB, 540x587
>tfw Django
>>
>>54686940
No we don't Grandpa, tell us more about how it used to be.
>>
>>54687000
>a trap
>make america great again
>>
What does
::before
and
::after

do?

I see them listed in some <section> tag and have no idea.
>>
>>54687051
https://developer.mozilla.org/en-US/docs/Web/CSS/::before
https://developer.mozilla.org/en-US/docs/Web/CSS/::after
>>
How do I make some smaller projects that are actually good for a portfolio? I literally can't stop making "50 lines of JS" apps that are overdesigned without someone to guide me. I have 0 ideas and I can't make myself develop yet another imageboard or todo app. Everything in this field is boring to me. This is somewhat a serious problem now because I'm finishing bachelors in a couple of months.
>>
>>54680145
Hey, I'm a total newfag to programming /or/ web development (My previous experience was just fucking around with css on Proboards as a teen), but I'm curious about this because I just started a book on C++

How do you guys link front-end and back-ends that operate using totally different programming languages?

Like, if the client-side is in HTML5 or Php or something, and the back-end in in C#, how do you connect the two?
>>
>>54687039
probably still contributes miles more than your average nigger.
>>
>>54687267
Your back-end parses the request, provided by the HTML, into a response, which the front-end receives as HTML/CSS/JS, etc
>>
>>54687267
>client side php
>>
I'm designing the maymayest of portfolio websites.

I will not be denied a job again.
>>
>this is a thing

$window.on('scroll', check_if_in_view);

I'm officially retiring vanilla.js for this bloatscript.
>>
>>54687438
Does its visage burn like the sun?
>>
>>54687454
It's what happened when a back-end dev figures out how to front-end.
>>
>>54687498
Show us when it's done
>>
>>54687509
wilco.
>>
>>54685037
Go
>>54686537
>haskell
>>
>>54685037
>using Django-REST
Just use plain Django. 400ms should not even be possible with it
>>
I'm going in to interview at a web dev/general tech support/hosting company that I used to work at in the tech support department. I want to be ready to do some stuff in PHP. Any suggestions of projects to complete in the next couple of days to get acquainted with web engineering?

Also, general interview tips for these types of companies. This will be the first software engineering job interview I've had.
>>
Can I upload my C++ program to Heroku or do they only support managed languages?
>>
Better practice to style <section>s instead of diving content?
>>
>>54688853
They don't support it natively. I think there's a third-party buildpack, but I'd bet it's going to get messy
>>
Craigslist is officially dead for web jobs now.

I remember seeing 10 posts a day and now it's a post every 10 days.
>>
>>54690040
Blame Pajeet
>>
>>54690282
I do, for everything, even when I stub my toe on the coffee table.
>>
So I learned about JS in uni and the teacher was pretty hard on enforcing unobtrusive javascript.
Then I start looking into Angular and you can't really use unobtrusive principles with that.
Is unobtrusive JS not that important or is Angular assbackwards?
>>
File: 430917.jpg (225 KB, 1920x1080) Image search: [Google]
430917.jpg
225 KB, 1920x1080
>>
>>54690492
delete this
>>
>>54690492
Your language is a disgusting mess and you know it, and we know you're just baiting. Get out Pajeet.
>>
I love laravel, any of you faggots who still havent moved on to the next big tech are fucking retarded.
>>
File: gopher_head.png (33 KB, 400x214) Image search: [Google]
gopher_head.png
33 KB, 400x214
Daily reminder that if you aren't using Go for your next big project you are missing out on "fun".

>What is Go?
https://golang.org/
>Whats wrong with Go?
https://github.com/ksimka/go-is-not-good
>Whats good/useful in Go?
https://github.com/avelino/awesome-go
>>
Anybody have Wordpress experience?

I have this site I'm working on, and I wanna get rid of a sidebar (or at least push it all the way to the right) to free up some room in the middle of a page. Do I have to edit the theme itself or is there a way to do it within the Wordpress GUI thing? I'm using Page Builder Sandwich at the moment.

I just downloaded Wordpress, but the theme I'm working on is being hosted on my partner's site. Not sure how to go about it
>>
So, uh, I've found this web-site code.org being advertised as a place to learn on how to code. So I went there and spent a few hours completing over a hundred tasks within their "Accelerated course" by moving angry birds and shit, I was really hoping that they will unlock some real coding after I complete this stuff for kids, but I don't see anything else there.
Is this web-site really just for kids? Or I have to complete every game to get something not joke-tier?
>>
>>54692239
Trying editing sidebar.php in the theme files you n00b
>>
>>54692245
>Launched in 2013, Code.org® is a non-profit dedicated to expanding access to computer science, and increasing participation by women and underrepresented students of color.
literal cancer, good job wasting your time, the bar is set so low because muh diversity that you wont find a single challenging thing on that entire site.
>>
>>54692297
I don't have the theme files. I'm working on a page that already exists on another dude's wordpress site. So I'm basically just dragging and dropping some shit to make the page look how we want.

How do I get the theme files?
>>
File: 0012391293.png (16 KB, 300x225) Image search: [Google]
0012391293.png
16 KB, 300x225
>>54680145
http://codepen.io/anon/pen/grVwON

I'm learning javascript by writing random functions. Is this syntax decent?
>>
>>54692379
You have three options.

1.) You can just hide it with CSS { display: none;}

2.) You can go to Appearance --> Editor and edit "sidebar.php" if you're confident that you won't fuck up something. This isn't recommended.

3.) If you have the credentials to FTP in, you can edit the theme files remotely using an FTP client (Filezilla, Cyberduck, etc.)
>>
File: Capture.png (140 KB, 1854x989) Image search: [Google]
Capture.png
140 KB, 1854x989
Is this way of making private and public classes in JS still relevant in ES2015? I heard they actually implemented classes in that shit so I'm guessing doing hacky stuff like this is not needed anymore?
>>
>>54692447
Thanks for the help man. I just downloaded the theme from the creator's site and gonna dick around with the source files and try to make the changes that way, and then upload it as a custom theme.
>>
>>54691594
Laravel is Wordpress of frameworks.
>>
>>54692441
Give up
>>
>>54692540
The classes are just syntactic sugar. The hacky stuff is still the same under the hood, since js is prototype-based and doesn't technically have real classes
>>
>>54692540
just use coffeescript so you can stop pretending functions are classes
>>
>>54693342
>new Date().getFullYear();
>using coffeescript and not typescript
>>
>>54683852
I'm a translator (majored in English, Spanish and French) and was given the opportunity to prove I had skills and some experience. Git the job.

People skills and contacts are waaay more important than degrees and shit.
>>
>>54684284

Get your shit together pussy. Play the cards you got and stop whining.

Otherwise you'll stay like this forever. Man up and do some interviews.
>>
File: angelina.jpg (119 KB, 728x440) Image search: [Google]
angelina.jpg
119 KB, 728x440
hmm so i read all the redux docs, understand the todo app etc

but now I don't care to use it to build some gay little project. wat do?
>>
>>54693849
- Get a job that uses Redux.
- Use it in your next personal project.
- Update an already existing personal project to use Redux
>>
>>54693881
I'm an idiot. I keep learning shit and not using it.

Learned cycle.js and a ton of rx.js this winter and already its fading.
>>
>>54693935
That's not too bad. I learned Ember and but never got to way to useing it. Yet I use similar frameworks in a comparative way in RSA application apps to know be more of like.
>>
i like atom.
>>
>>54694054
I like when my text editor doesn't take 5 minutes to load and then crashes randomly.
>>
>>54694076
that sounds like a personal problem.
>>
File: 1454640061246.jpg (291 KB, 955x1350) Image search: [Google]
1454640061246.jpg
291 KB, 955x1350
I was told that putting logic in my HTML was bad practice, but I'm looking at React and Angular and they both do that, is it literally OK when Google and Facebook do it?
>>
File: 1459282763905.png (229 KB, 800x774) Image search: [Google]
1459282763905.png
229 KB, 800x774
>>54694087
Spoken like a true dev
>>
>>54690492

Nobody got that sublte humour..


>>54693075

Laravel is great.
Even if you don't like it, Laravel single-handed revived a whole programming language.
>>
>>54694126
Taking all the shit that ought to be in a .js file and dropping it between script tags under your body is a bad practice (usually).

Linking your views to your controller is not what people mean when they say that.
>>
>>54694126
that different.
you arent putting your logic into your index file.
and a small bit of logic like bootstrapping or shivs/polyfills are fine.
dont write your entire application inside your index thats retarded.
>>
So whats the difference between WebDev and general programming?
>>
>>54694226
webdev is general programming.
>>
>>54694226
Writing an essay in a single language compared to writing an essay in six different languages simultaneously along with several obscure Bushman dialects Sumerian hieroglyphs
>>
File: 1463513088247.jpg (117 KB, 600x803) Image search: [Google]
1463513088247.jpg
117 KB, 600x803
>>54694248
Which is which
>>
>>54694315
Does that work?
>>
File: 1462912532962.jpg (321 KB, 1600x1200) Image search: [Google]
1462912532962.jpg
321 KB, 1600x1200
>>54694504
Yes, easy ankle remover.
But really whats the difference between software dev and a webdev
>>
File: aye.jpg (72 KB, 600x800) Image search: [Google]
aye.jpg
72 KB, 600x800
can any anons help me position iframe on a specific part of site similar to how it's done here: http://cyberstarweb.com/how-to-position-a-page-within-an-iframe-using-css/

on this part: https://i.imgur.com/T955oqY.png

of this site: http://xtremevr.pgtb.me/xRN4ZR/kQTSn?w=47839208&e=126069054

$1 paypal to the anon that helps me out, just leave your paypal.me link with the post
>>
>>54694556
>2016
>using iframes
die.
>>
>>54694556
Good golly gosh this better be bait
>>
>>54694504
The PVC would explode. It might inflict some minor injuries.
It would be capable of fucking someone up if they used a metal pipe.
>>
>>54694575

is there an alternative?
>>
>>54694546
>But really whats the difference between software dev and a webdev

Web dev is a subset of software dev.
Web developers are developers who make software specifically for the web.
>>
>>54691974
>https://github.com/ksimka/go-is-not-good
>Making a software repo dedicated to documents against another software.
Fucking nerds. Whenever someone has an initiative. there always has to be someone to find problems with it and declare it "not good". How about fixing the problems instead? Oh, that would require doing work and admitting anything but what you use has potential.
>>
>>54684942
Komodo Edit
>>
>>54694707
>"Hey, I thought $someMovie was pretty good, but it would have been better if they did x, y, and z"

>FUCKING NEERRRD IF YOU HAVE SO MANY PROBLEMS WITH IT, WHY DON'T YOU GO FILM YOUR OWN MOVIE OH WAIT THAT WOULD REQUIRE DOING SOME WORK
>>
Britfag here, would voting to leave the EU hurt or hinder my webdev job prospects?
>>
>>54694955
>voting
>>
>>54694955
Just do it you pussy
>>
>>54694955
The banking industry is the largest industry in the UK, so if you dont mind the ECB (the Bundes Bank) taking assets from UK banks and UK government whenever they want, then yes you might want to save your non-existant IT industry by staying in the EU
>>
>>54694707
you completely missed the point of the repo, yes it points out go's weaknesses, but its purely for the purpose of making sure you're able to avoid those pitfalls. knowing about problems before they come up is a great bit of information to have.
>>
>>54695142
>brings up something completely irrelevant
I asked how it would effect my webdev career.
This is why leave is going to lose.
>>
>>54695292
oh, Im sorry, here is direct advice, UK should stay in the EU so you will have better webdev opportunities
>>
>>54695509
heh, technology these days
p0wned
>>
>>54695509
wat
>>
opinions on vscode.
>>
>>54695670
made a userscript to reply to everybody
>>
>>54695711
Oh nice. Lets see it
>>
>>54695711
automated captcha?
>>
Er so new nigga here, how long to understand and code html shit?
>>
File: file.png (148 KB, 1033x1080) Image search: [Google]
file.png
148 KB, 1033x1080
>>54695691
its okay
i like the type hints and the stuff highlighting
i normally use notepad++ btw
>>
>>54695928
a week if you are not retarded for basic stuff and simple websites. a month or so for javascript enough to be useful to you.
years to fully understand how everything works.
>>
>>54695928
As with anything, if you understand it conceptually, learning it is easier.

HTML is a declarative language, rather than being a set of steps to format a page, it just declares the elements inside and your web browser will render it according to current web standards

Now you just need to research the different tags, note them down, but also use it creatively in designs you can think up
>>
started going through project euler yesterday to better learn programming in general.
im doing one challange a day.

r8 my approach to the second challange.
tell me what i can do better or just shittalk me.

// https://projecteuler.net/problem=2
'use strict'
let fib = function (x) {
let startingvalue = [1,2]
let fibnum = 0;
for (let i = 0; i < x; i++){
if (fibnum < 4000000){
fibnum = (startingvalue[startingvalue.length-1] + startingvalue[startingvalue.length-2])
// sum the last two numbers in the arrey than push em to the orignal
startingvalue.push(fibnum)
// console.log(fibnum)
}
}
console.log(startingvalue)
return startingvalue
}
let sumEvenNumbers = function(fibs){
let evenNumbs = fibs
//check if every number in the arrey is divisible evenly by 2 if it is push the new number to evenNumbs
fibs.forEach(function(element) {
if (element % 2 === 0) {
evenNumbs.push(element)
}
});
return evenNumbs
}

let getSum = function(numbs) {
//sum up all the numbers in the passed over arrey and return it, arrow function for simplicity.
return numbs.reduce((a, b) => a + b, 0)
}

console.log(getSum(sumEvenNumbers(fib(200000))))

>>
>>54695729
no bully
https://linx.li/aaaaaaaaaaaaa.js
>>
>>54696638
just now noticed a small bug.
fibs should not be assigned to EvenNumbs.
>>
>>54696638
messy whitespace and inconsistent semicolons, useless comments, not using function statements

i would use `for (let element of fibs)` instead of `.forEach`
>>
>>54696807
got it ill rivise the for loop.
already fixed the semicolons i really just use them inside forloop statements.
fixing the whitespaces too.
thanks a bunch.
the comments are there just to get into the habbit of commenting. i usually dont which is bad.
>>
>>54684534
>>54695509

Dude, you guys did the same thing on the same thread.
>>
I'm getting a fucking headache /g/

Beginner here.

var findLargestSum = function() {
var myArray = ['4916-2600-1804-0530', '4779-252888-3972', '4252-278893-7978', '4556-4242-9283-2260'];
var stringArray = myArray.toString();
stringArray = stringArray.split("")
for (i = 0; i < stringArray.length; i++){
stringArray.replace(/"-"/g, '')
parseInt();
}
return stringArray;
};
findLargestSum();


Why is replace not registering as a function to remove the dashes?
>>
>>54699038
Your regex is wrong. http://regexr.com
>>
>>54699038
Also, you aren't even saving the new string replace() creates https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace
>>
>>54699080
Actually got a little further ahead, I had to make it a string again since split turned all my string's into arrays again.

So I converted it back into a string.

Now I'm having a problem where "-" isn't working.

Slowly getting there.

How would I replace the - so it's a 0 value or completely removed?

var findLargestSum = function() {
var myArray = ['4916-2600-1804-0530', '4779-252888-3972', '4252-278893-7978', '4556-4242-9283-2260'];
var stringArray = myArray.toString();
stringArray = stringArray.split("");
stringArray = stringArray.toString(parseInt);
stringArray = stringArray.replace("-")
/*for (i = 0; i < stringArray.length; i++){
stringArray.replace(/"-"/g, '')
parseInt();
}*/
return stringArray;
};
findLargestSum();
>>
>>54699152
Ran it through the loop actually and removed my -.

var findLargestSum = function() {
var myArray = ['4916-2600-1804-0530', '4779-252888-3972', '4252-278893-7978', '4556-4242-9283-2260'];
var stringArray = myArray.toString();
stringArray = stringArray.split("");
stringArray = stringArray.toString(parseInt);
for (i = 0; i < stringArray.length; i++){
stringArray = stringArray.replace("-", '0')
}
var reduceArray = stringArray.toString(parseInt)
return reduceArray
};
findLargestSum();


Now I gotta get these god damn arrays to reduce and add up.
>>
>>54699286
Gotta call it. I can't figure out how to add my Arrays.

I finally learned though /g/. Be proud of me.

Can someone point me in the direction of adding my arrays?
>>
>>54699476
what do you mean by adding
>>
>>54680773
less has this.
>>
Hey lads,

I've got a bunch of divs spat out from php reading xml, but I want different sorting options.

Should I use:
>XLST to transform xml in an AJAX request.
>sort DOM Nodelist on client side (best practice right?)

If i so, have you guys ever sorted divs based on the
data-<name>="value"
attributes?

Advice me please
>>
I find whenever I'm doing web stuff I find myself following less OO principals and things. I even found the first time I've needed to use a for loop in JS and just had no idea on the syntax.

Do you guys find this is the case, due to scripting rather than OO / Procedural programming? Or am I just not applying the principals of regular programming?
>>
>>54700080
Am I understanding correctly - you did not know how to use a standard C-style for loop and somehow it's related to OOP?
>>
>>54700173
I knew how to use a for loop, I use them frequently even in PHP.

But in JS, I rarely implement them, so much that I didn't know the specific syntax. I'm wondering if this makes me a shitty programmer, not applying these simple control statements, or do others find that they're less used typically in web development.

Sorry if I'm miscommunicating
>>
>>54700201
Well, JS has both functional array manipulation methods (forEach, map, reduce, filter, fill, etc.) and procedural C-style for loops. So which to use, is up to the developer (a for loop is still always faster at the moment). Now, if you don't use either in your code, then yes - you are most likely a shitty programmer.
>>
>>54700037
bump for help, I do not want to use xlst.
>>
>>54700037
Don't sort AFTER dom generation, sort before-hand!
That's a bunch of extra string processing for no good reason, and really isn't the purpose of the "data-" attribute.

Parse your AJAX response from XML, sort the data, THEN generate the DOM nodelist afterwards, followed by a single call at the end to append it in the page.
>>
>>54700080
I find, that I find, and I also find.
Basically...I find.
>>
>>54700251
Be careful with forEach, it's not in older shitty browsers.
>>
>>54699476
>>54699286
>>54699152
>>54699038

what the hell are you even trying to make?
what's the end goal of this code?
we aren't mind readers anon, give some context, and be more specific rather than just saying "adding arrays".
>>
>>54700309
My PHP script echos the html tags

I.E. <div data-p='value'>

It's only now occurring to me that this really very inefficient. When did you guy stop writing spaghetti code? Sometimes I don't think I will
>>
>>54700328
http://caniuse.com/#search=forEach
Who cares? XP is not even supported any more.
>>
>>54699286
seriously dude, wat
var findLargestSum = function() {
var myArray = ['4916-2600-1804-0530', '4779-252888-3972', '4252-278893-7978', '4556-4242-9283-2260']; //don't hardcode shit in inane formats
var stringArray = myArray.toString(); //you have no clue what the toString() method does do you? use join()
stringArray = stringArray.split(""); //this splits the entire string up to an array of characters. Are you insane?
stringArray = stringArray.toString(parseInt); //toString does not take any fucking arguments pajeet
for (i = 0; i < stringArray.length; i++){ //always nice to have a global i variable
stringArray = stringArray.replace("-", '0') //I have no idea why you are doing this but it can't be good //also it's stringArray[i].replace
}
var reduceArray = stringArray.toString(parseInt) //NOPE
return reduceArray //consistent style is the bane of all programmers
};
findLargestSum();

have a non retarded way of doing it, perhaps you'll learn a thing or two about javascript. or programming.
function largestSum(numbersInARetardedFormat){
return Math.max.apply(this, numbersInARetardedFormat.map(function(currentValue){
return currentValue.split("-").reduce(function(previousValue, currentValue){
return +(previousValue)+(+currentValue);
});
}));
}
largestSum(['4916-2600-1804-0530', '4779-252888-3972', '4252-278893-7978', '4556-4242-9283-2260']); //it hurts to live
>>
>>54700358
Yeah see in this case your PHP could just output a basic response to an AJAX request, in XML or JSON, and then the client can do the rest.

I'm guessing you want all the logic on client-side, with the server just handling requests for data?

>>When did you guy stop writing spaghetti code? Sometimes I don't think I will
I find that looking through lots of different projects, and reading their code, is how you minimize your own spaghetti habits.
Reflect on the work of others, and then improve your own. Ask yourself why they've written that small chunk of code in a certain way, and what their intentions were at the time of writing it, as opposed to how you yourself would do it.
Think of the many different ways a simple yet useful piece of code can be written, and ask why each way is either better or worse.
>>
>>54700366
- XP is officially supported until 2019 for POS systems.
- Vista and early releases of 7 still have this problem too.
- Do more extensive research rather than just relying on caniuse. If this was CSS I wouldn't care so much, but come man a broken loop could completely kill your app.
>>
What is better to start off? Frontend or backend?
>>
>>54700589
I understand what you mean, but these things don't occur to me when writing code.

I'll try to re-write a bunch of this.
>>
>>54700630
Fair point, but not using modern (2009 was 20 years ago) features because of shitty browsers is an excersize in frustration. What I do is check for features, that I am using in a small bootstrap script, and if even one of them fails, load core-js and another MB of assorted polyfills.
>>
>>54700634
Both.
Full-stack is preferred now, unless you're strictly only doing design or UI/UX work.
>>
File: frustrationcademy.png (117 KB, 1435x928) Image search: [Google]
frustrationcademy.png
117 KB, 1435x928
Guys, what's wrong with my hello-world? It returns what they want on prompt. And the "Hint" button just says to use switch instead of if/else and doesn't actually give me any hint.
>>
>>54700749
2009 is 7 years ago, also you don't need polyfills for simple vanilla JS practices.
I'm gonna assume your entire post is a joke at this stage.
>>
>>54700856
you get the movie title as a parameter to your function, no need to prompt for it
>>
>>54700856
>what's wrong with my hello-world?
Its JewaScript
>>
>>54700856
- remove prompt
- return the value itself rather than returning a console.log
>>
>>54700923
Only half-joking. I have this array of test function strings, and if one of them fails, I load bloated Babel compiled ES5 files with core-js, Fetch API and some other polyfills. It is actually only a few hundred kilobytes more, but runs notably slower. Admittedly, not very comprehensive tests.
var tests = [
// Arrow functions
'return (()=>5)()===5;',
// Block scoped const
'"use strict"; const bar = 123; {const bar = 456;} return bar===123;',
// Block-scoped let
'"use strict"; let bar = 123;{ let bar = 456; }return bar === 123;',
// Computed object properties
"var x='y';return ({ [x]: 1 }).y === 1;",
// Shorthand object properties
"var a=7,b=8,c={a,b};return c.a===7 && c.b===8;",
// Template strings
'var a = "ba"; return `foo bar${a + "z"}` === "foo barbaz";',
// for...of
'var arr = [5]; for (var item of arr) return item === 5;',
// Spread operator
'return Math.max(...[1, 2, 3]) === 3',
// Class statement
'"use strict"; class C {}; return typeof C === "function"',
// Super call
'"use strict"; var passed = false;'
+ 'class B {constructor(a) { passed = (a === "barbaz")}};'
+ 'class C extends B {constructor(a) {super("bar" + a)}};'
+ 'new C("baz"); return passed;',
// Promises
'return typeof Promise === "function"',
// Default parameters
'return (function (a = 1, b = 2) { return a === 3 && b === 2; }(3));',
// Destructuring declaration
'var [a,,[b],c] = [5,null,[6]];return a===5 && b===6 && c===undefined',
// Parameter destructuring
'return function([a,,[b],c]){return a===5 && b===6 && c===undefined;}'
+ '([5,null,[6]])',
// Fetch API
'return typeof window.fetch === "function"'
]
>>
File: 1442857291437.png (169 KB, 300x296) Image search: [Google]
1442857291437.png
169 KB, 300x296
how to get better at HTML/CSS? already completed the codecademy tutorial, going through that dere Duckett book, but what's a good idea next? I feel like reading is a waste
>>
>>54701096
>>how to get better at HTML/CSS
- Find UI/UX designs on dribbble and try to accurately re-create them in HTML/CSS.
- Use Adobe Brackets, it's geared towards making HTML and CSS development as seamless as possible.
>>
File: 1437317682603.png (345 KB, 500x500) Image search: [Google]
1437317682603.png
345 KB, 500x500
>>54701137
thanks sir
>>
What do you guys think about zend?
>>
>>54701148
no probs
>>
So I made a very simple function:
function flo(number) {
var hold = number - Math.floor(number);
console.log(hold);
}

flo(10.4); == 0.40000000000000036
flo(1.4); == 0.3999999999999999
flo(1.6); == 0.6000000000000001
And the only number that would work the way I expected are the ones that have 5 after dot:
flo(1.5); == 0.5
flo(1.532); == 0.532

Why does it work like that?
>>
I have to finish a site in one week but I can't handle backend.
I just learned PHP like a month ago and I have to deal with these login and user functions and display different data for each.

I should've rolled for linguistics instead.
>>
>>54702254
Give me 200 bucks and I'll do it.
>>
>>54701986
there's a whole fucking thread about it
>>
>>54702271
Sent to you via Bitcoin.

But seriously I don't think it should be that complicated, I just have to get the current user's email and get the ID of the foreign table to display the data. Already finished with login and stuff.

Now I should motivate myself to actually put it to code.
>>
Anyone got any good ideas for sites I can create and put on my github?
>>
started looking into react today

I feel like there's so much boilerplate and preprocessor shit just to get it all running, it all feels so hackish

is this what web dev is about nowadays?
>>
>>54702453
Just use a yeoman generator or something.
>>
>>54702453
Yes, web languages weren't meant to do what we do today so everything feels like a hack and that it could break at any moment. Blame the World Wide Meme Consortium.
>>
>>54702453
that is what react webdev is like. webdev has become a huge field in the last couple of years and the spectrum of tools is really wide, from hacky to 'that makes sense'
>>
>>54702453
BackboneJS is better than React and Angular in my opinion, but I might be biased.
I hate that about web dev though. When you're working with Node, Python, etc. you will always have to be managing dependencies and modules.
>>
I am a student in college, how do i learn jsp servlets with a tomcat server in 2 months? The lectors course was horrible and his examples existed out of code snippets. He never once showed us how to do it yourself, he only gave use snippets and expects us to now be capable of creating our own jsp servlet server.
>>
>>54703481
>jsp servlets with a tomcat server
oh shit senpai, blast from the past
>>
>>54703556
i know, but that college is the most modern, but that one lector is stuck in the past, all his courses are outdated and badly given. I mean his powerpoints talk about tomcat server version 5
>>
File: Screenshot at May 23 11-53-11.png (117 KB, 1936x480) Image search: [Google]
Screenshot at May 23 11-53-11.png
117 KB, 1936x480
just
>>
>>54703671
It happens and it will happen again, sweetie.
Stay strong and keep coding.
>>
>>54703714
Fuck off
>>
>>54703714
I wouldn't really be that upset except that out of 45 applications I sent out this was the only place that even replied
>>
File: New Canvas.jpg (222 KB, 483x469) Image search: [Google]
New Canvas.jpg
222 KB, 483x469
so i'm trying to make a dropdown appear on hover. I get the logic behind it but it doesn't work quite right because the list is squished into the size of the button's dimensions. what am I doing wrong here?

HTML:
 <nav class='navbar navbar-inverse text-capitalize'>
<div class="container-fluid">
<div class="navbar-header">
<a href="index.php" class='navbar-brand'>FDC</a>
</div>
<ul class='nav navbar-nav'>
<li>
<a href="viewAllListings.php">Services</a>
<ul>
<li>LONG ASS NAME</li>
<li>BTN 2</li>
<li>BTN 3</li>
</ul>
</li>
<li><a href="createListing.php">Suppliers</a></li>
</ul>
</div>
</nav>


CSS:
ul{
list-style:none;
}

li > ul{
display:none;
position:absolute;
}

li:hover > ul{
display:block;
}
>>
>>54703768
We send love! Keep trying!
>>
So I have a web application behind nginx, the route handler has these options set:

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;

Now should I use X-Forwarded-For or X-Real-IP to get the IP address of the user?
>>
>>54703768
Oh shit you're just like me. >>54685205
At this point I've pretty much seen every iteration of a rejection email possible. Some of them do make it clear while applying, however, that if they don't see you as a suitable candidate you basically won't hear anything from them.
>>
>>54704599
Read the X-Forwarded-For header in your backend?
>>
>>54704732
Yeah I know I'm just not sure what's the difference between X-Forwarded-For and X-Real-IP and which one I should favor?
>>
>>54704652
The only place I interviewed at so far put me through 4 interviews. One phone interview, then they had me come in for back-to-back meetings with three of their regional managers. Took almost three and a half hours. Despite that I thought it went really well, they said "they'd be in touch either way, in 3-4 days".

That was three weeks ago and I didn't even get a "thanks for putting up with all that shit at least"
>>
>>54703831
That's normal since you nested the second UL, it's limited by it's parent's width
Just set a width for the sub-menu

 li > ul {
width: 200px /* or something*/
}


I haven't done too many menus myself, this is a really old problem and people have tons of solutions for it. Look up "Son of suckerfish" pretty solid http://www.htmldog.com/articles/suckerfish/dropdowns/
>>
>>54704797
Go back in, show them you're still interested. If I were you I would have at least called them after 7 days.
>>
>>54703768
I know this feeling.
>>
File: New Canvas.jpg (150 KB, 721x351) Image search: [Google]
New Canvas.jpg
150 KB, 721x351
>>54704881
thanks, I got ahead but it's just one problem after another it seems. I wonder if this can be solved by changing my column sizes or if this is an easier fix than it looks
>>
>>54705034
This is kind of hard to tell what's going on
from the classes you use i'm assuming you're using bootstrap css?
http://getbootstrap.com/components/#navbar

It looks like you have a breakpoint at <1200 that removes float on your top <li> elements, or they have a width of 100% or something

Either way, find that query breakpoint and tweak your submenu there, probably need to remove the absolute position and add some left margin so they are indented
>>
Doing what that one anon said and trying to go to a meetup group next week.

It's about Angular and React.
>>
>>54702453
It's totally possible to write it in pure JS. I've been doing this for a while because Sprockets can be a little bitch about precompiling things.
>>
>>54702453
Yes.
>>
File: 1463163871739.jpg (132 KB, 1368x768) Image search: [Google]
1463163871739.jpg
132 KB, 1368x768
I've never used an IDE in my life because teachers said it created bad habits.

Any good ones for PHP? I usually use Sublime these days. Which is kind of an IDE, but not really.

Do I even need an IDE for PHP, actually? I'm pretty dumb so please illuminate me, /wdg/
>>
>>54706345
I don't think you need one, all you need is a local php host
>>
>>54706345
you don't need one, but it can improve your productivity if you know how to use it.
>>
>>54706500
any good ones?
>>
>>54706345
You definitely don't *need* one. I also use sublime. (Not a filthy PHP dev though.) If you want to try it out, Brackets is a pretty good free one. It has some useful php plugins and whatnot, iirc.
>>
>>54706524
>(Not a filthy PHP dev though.)
I'm mantaining existing PHP code, and I don't really know any fancy meme.js frameworks
>>
>>54706524
http://stackoverflow.com/questions/116292/what-is-the-best-ide-for-php

choose yourself
>>
>>54706345
PhpStorm really improved my productivity
>>
>>54706621
I'm 90% sure you're trolling me
>>
>>54706541
you linked me to a 5 year old page

this is web development
>>
>>54706647
Just look at those that are still updated, i personally use phpstorm, but i have never used another one so i can't give you a personal experience of other ide's.
>>
Do any of you actually use things like augmentation, global imports, fall-throughs with switch blocks and exception handling? I've been doing the best practices course in codeschool but they don't really give any working examples of how those things can actually work in real code. I kinda understand the concepts but I'm still very new to Javascript.
>>
>>54706345
> Any good ones for PHP?
Programmers at my work use PHPStorm.
>>
>>54706743
Student here
There is a sort of retarded programmer debate going on. some will avoid using if's and use as many switches as they can whille others will avoid switches like the plaque. I honestly don't see the problem with using both if they need arises.

I have used prototyping and it can be very useful, if you like OO.

>exception handling
unless you are using ajax, i don't see why you should use exceptions.
>>
I'm trying to learn the new Angular2 and turns out I must also know typescript.
How much time am I seeing in learning typescript. I know JavaScript well.
>>
>>54687000
who is she
>>
>>54707146
You can use angular 2 without typescript, but it's actually pretty great and not that hard. Once you start using it, you'll have a hard time going back.
>>
>>54707160
>she
>>
I need a dev job.
>>
>>54706743
>augmentation
Yes.
>global imports
Bad practise.
>fall-throughs with switch blocks
Yes.
>exception handling
Yes.
>>
>>54707146
5-10 hours, if you already know ES6.
>>
>>54685519
http://lkml.iu.edu/hypermail/linux/kernel/0810.2/1735.html

A legend
>>
>>54706274
Of course it's possible, but frameworks add practicality, scalability, and reusability.
>>
>>54708889
No I mean writing React in pure Javascript. You don't need any of the preprocessing, and the boilerplate actually isn't that large (probably about 12 lines with the first component).
>>
>>54708652

Where do you want to work?
>>
>>54708750
Why are global imports bad practice?
>>
>>54708967
Austin or Houston areas
>>
>>54709028
DFW anon here. How are the jobs there? Plenty here but no interviews for me.
>>
>>54709028

What kind of company, anon? Be specific - a web agency? A meme startup?
>>
>>54709070
Idk, I live in corpus but have family in both. Plan on moving next month to one of them.

>>54709176
I dont think I have a preference.
>>
>>54709234
Both are good for web dev jobs so get applying.
>>
Does anyone know any good e-commerce platforms or software? Currently looking for a solution for my dad's small business. Looking at shopify but unsure as I've never used it before. Thanks.
Thread replies: 255
Thread images: 25

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.