• Hey, guest user. Hope you're enjoying NeoGAF! Have you considered registering for an account? Come join us and add your take to the daily discourse.

Web Design and Development |OT| Pixel perfect is dead, long live responsive design

ethanny2

Member
Don't know if this should be on the programming board, but since I am using Javascript I have a number that is nanoseconds since epoch time (Unix)
e.g. 953593200000

and I want to convert it to a human date object in Javascript, since you can do

Ex:
var date = new Date( some_value_in_miliseconds_since_epoch);

I thought just dividing by 1000000 would work (1 milisec = 1000000 nanosecs), but it is still not right, anyone know how?
 

Nelo Ice

Banned
My experience is that it's pretty hard to jump into random open source projects. I pretty much have to be using it my company/project and thus need some sort of functionality fixed in order to feel natural about contributing.

My advice is to start your own project and open source it or look for things like Digital Ocean's Hacktoberfest in which companies/projects seek new/first time contributors. There are also sites like this one which aggregate certain tags meant for people looking to contribute but I have never used them personally.

Thanks yeah I've looked through that site and got nowhere. Right now I'm finally more comfortable reading source code I that I didn't write and understanding what it's doing. So trying to get to the point that I can be useful in an open source project since I'm either learning how to read code or working on a project in hopes I'll have a developer job soon.
 

Somnid

Member
Don't know if this should be on the programming board, but since I am using Javascript I have a number that is nanoseconds since epoch time (Unix)
e.g. 953593200000

and I want to convert it to a human date object in Javascript, since you can do

Ex:
var date = new Date( some_value_in_miliseconds_since_epoch);

I thought just dividing by 1000000 would work (1 milisec = 1000000 nanosecs), but it is still not right, anyone know how?

This is correct. Some ideas:

- Is it actually nanoseconds?
- Is the timestamp correct?
- Is there a timezone difference you need to account for?
 

ethanny2

Member
This is correct. Some ideas:

- Is it actually nanoseconds?
- Is the timestamp correct?
- Is there a timezone difference you need to account for?

- Is it actually nanoseconds? Yeah someone asked the API author and he said its "It is unix in nanoseconds instead of miliseconds"
- Is the timestamp correct? (I think so, don't really know for sure since there is no unix nanoseconds to date converter...)

Hmm don't think the timezone difference is a problem, but I am getting a JSON response from an API about video games and the release date is in nanoseconds, here is how the raw JSON looks

Code:
 "release_dates": [
      {
        "category": 0,
        "platform": 6,
        "date": 953593200000,
        "region": 2
      }....

So I just wrote

Code:
  function dateConverter(UNIX_timestamp){
  console.log("Miliseconds is "+  Math.floor(UNIX_timestamp/1000000));
  var a = new Date(Math.floor(UNIX_timestamp / 1000000));
  var year = a.getFullYear();
  console.log('converted year is' + a.getFullYear());
  return time;
}
but I keep getting some weird year like 1970 (correct year is like 2000)
 

Somnid

Member
- Is it actually nanoseconds? Yeah someone asked the API author and he said its "It is unix in nanoseconds instead of miliseconds"
- Is the timestamp correct? (I think so, don't really know for sure since there is no unix nanoseconds to date converter...)

Hmm don't think the timezone difference is a problem, but I am getting a JSON response from an API about video games and the release date is in nanoseconds, here is how the raw JSON looks

Code:
 "release_dates": [
      {
        "category": 0,
        "platform": 6,
        "date": 953593200000,
        "region": 2
      }....

So I just wrote

Code:
  function dateConverter(UNIX_timestamp){
  console.log("Miliseconds is "+  Math.floor(UNIX_timestamp/1000000));
  var a = new Date(Math.floor(UNIX_timestamp / 1000000));
  var year = a.getFullYear();
  console.log('converted year is' + a.getFullYear());
  return time;
}
but I keep getting some weird year like 1970 (correct year is like 2000)

Pretty sure that's in milliseconds.
 

Tathanen

Get Inside Her!
So anyone have open source projects or can recommend ones to contribute to?. I've only made 1 open source contribution and that was fixing a typo for freecodecamp but I'm learning and trying to contribute actual code like bug fixes or new features. So far haven't found any projects that I can contribute to yet or there's no issues that I think I can tackle at my current level.

I find it's best to submit issues/fixes/features to codebases you actually use. Most of my contributions are of that ilk, to things like drone.io, ngDialog, and realfavicongenerator. As you use libraries, you'll find bugs or come up with things you'd like to see tweaked, and it'll give you easy jumping-in points.
 

Nelo Ice

Banned
I find it's best to submit issues/fixes/features to codebases you actually use. Most of my contributions are of that ilk, to things like drone.io, ngDialog, and realfavicongenerator. As you use libraries, you'll find bugs or come up with things you'd like to see tweaked, and it'll give you easy jumping-in points.

Ahh I don't have nearly enough experience using libraries to understand their ins and outs but that makes sense. I'll keep improving my general programming and hopefully I'll be able to contribute soon.
 
Ahh I don't have nearly enough experience using libraries to understand their ins and outs but that makes sense. I'll keep improving my general programming and hopefully I'll be able to contribute soon.

It also works the other way around: contributing to open source projects is a great way to get better at general programming. Most* of the OSS projects are friendly and welcoming and will gladly help you on learning the ins and outs of the said libraries during the (review) process. Like you said, the hard part is finding the projects to contribute to, but just check around the repositories you use in your own projects.

Also checkout https://github.com/MunGell/awesome-for-beginners
 

5olid_5nake

Member
I was trying to make a simple address book in php, that has a name, surname, address, e-mail and phone number with the possibility to add, edit and delete files in the database. Does anyone have an example or something similar that I could ease myself into it?

I thought this would be a perfect example for a beginner such as myself.
 
I was trying to make a simple address book in php, that has a name, surname, address, e-mail and phone number with the possibility to add, edit and delete files in the database. Does anyone have an example or something similar that I could ease myself into it?

I thought this would be a perfect example for a beginner such as myself.

I don't have a tutorial in hand, but assuming you've got the bare basics of PHP, I would look up:
- Setting up a database in your server, such as creating the database, table and insert dummy data. MySQL is the usual database option. Can be done manually (recommended) or through phpMyAdmin
- Learn how to connect to that database through PHP. You can use mysqli_() or PHP PDO. Do not use the old functions prefixed by "mysql_", because they are deprecated.
- Read data from that database then print it out.

I would just focus on learning how to read data before modifying them.
 

Maron

Member
Having some annoyances with my webcomic's site that seem like they should be simple, but I'm just at a loss since I'm very slowly only learning bits and pieces of this stuff.



So one of the alterations I want to make is removing this default gray box that sits next to the small image I made for the header, and to use that space potentially for ads and such. This is WordPress running ComicPress by the way.

Problem is I'm clueless on how to do it, but I know it at least can be done since another site running the same program pulled it off (and was one of the inspirations on me going with ComicPress due to it's attractive site layout).


I'm using a child theme I created based on ComicPress and when contacting the main guy behind that program these days, he told me to copy the header.php file from the parent theme into the child theme and then edit accordingly to remove the default box my header image sits with. Any idea how I can do that, or what code I need to edit/add to get rid of that default header area?


Hm, so I see now that putting
.page-title {
display: none;
}
into my Child Theme CSS removes the header...problem is it does this including my own uploaded image (trying to re-add in customizations didn't do the trick either, so I just undid it). With that my menubar just touches the top of the webpage. Somehow I feel I'm a little closer though.
 
Hm, so I see now that putting

into my Child Theme CSS removes the header...problem is it does this including my own uploaded image (trying to re-add in customizations didn't do the trick either, so I just undid it). With that my menubar just touches the top of the webpage. Somehow I feel I'm a little closer though.

The child theme will override the template files from the parent theme, so do what he said about copying the header.php file into the child theme folder, then see if you can find the specific code that refers to what you are trying to alter, and edit that part on the child theme header.php file.

Sometimes with bought these identifying what needs to be altered if you are a novice at reading PHP because they can be a little code heavy, especially in things like the header files, because they take a lot of conditionals into consideration.
 

Maron

Member
The child theme will override the template files from the parent theme, so do what he said about copying the header.php file into the child theme folder, then see if you can find the specific code that refers to what you are trying to alter, and edit that part on the child theme header.php file.

Sometimes with bought these identifying what needs to be altered if you are a novice at reading PHP because they can be a little code heavy, especially in things like the header files, because they take a lot of conditionals into consideration.

I've grabbed the header.php from my Parent Theme, but my issue is I have no idea what edit to make and where to make it so I get rid of the header.
 
I've grabbed the header.php from my Parent Theme, but my issue is I have no idea what edit to make and where to make it so I get rid of the header.

If you are having trouble, just start putting in small test edits to see where it gets inserted into the layout. Like literally type "test" into the file and see where it gets printed out. this will help you ID where the location is.
 

Somnid

Member
My thing with Open Source Software is if I get interested enough in what it does I just start writing my own version of it, otherwise the most I do is submit bug reports.
 

Nelo Ice

Banned
It also works the other way around: contributing to open source projects is a great way to get better at general programming. Most* of the OSS projects are friendly and welcoming and will gladly help you on learning the ins and outs of the said libraries during the (review) process. Like you said, the hard part is finding the projects to contribute to, but just check around the repositories you use in your own projects.

Also checkout https://github.com/MunGell/awesome-for-beginners

Ahh thanks. I've actually used alot of the stuff listed in that repo. Hopefully something comes up or I can end up finding an issue to fix.
 

Stopdoor

Member
Hey, has anyone here used Trello? A newcomer to my team introduced it to the 2-3 of us, and since our team is small and growing it did seem a good fit to keep better track of tasks we're doing.

We also need some form of documentation or knowledge-base for new people to read when they come in. I was thinking Trello could actually be pretty good for that, it can be like a wiki, anyone can edit or reorganize content, it's easy to glance over and see how things are categorized.

My teammates think a more traditional document wiki on our code repo is a better idea. I can see how keeping the docs more standard and attached to the code could be a good idea, but I'm kind of disappointed with the view 'that's not what Trello is for'. Any thoughts? Am I dumb for mis-using a tool?
 

Tathanen

Get Inside Her!
Hey, has anyone here used Trello? A newcomer to my team introduced it to the 2-3 of us, and since our team is small and growing it did seem a good fit to keep better track of tasks we're doing.

We also need some form of documentation or knowledge-base for new people to read when they come in. I was thinking Trello could actually be pretty good for that, it can be like a wiki, anyone can edit or reorganize content, it's easy to glance over and see how things are categorized.

My teammates think a more traditional document wiki on our code repo is a better idea. I can see how keeping the docs more standard and attached to the code could be a good idea, but I'm kind of disappointed with the view 'that's not what Trello is for'. Any thoughts? Am I dumb for mis-using a tool?

Use trello for very basic task management, like a Kanban flow. Don't use it for Scrum, I'm working with a client that's doing that now and it just isn't robust enough.

Per your actual question tho, there are better tools for documentation. The point of trello is to organize small things that you move through a process, not to really be a repository for evergreen content. That all content is loaded in a thin column in modal dialogs is enough reason to not use it for serious reading or writing.
 

Stopdoor

Member
Use trello for very basic task management, like a Kanban flow. Don't use it for Scrum, I'm working with a client that's doing that now and it just isn't robust enough.

Per your actual question tho, there are better tools for documentation. The point of trello is to organize small things that you move through a process, not to really be a repository for evergreen content. That all content is loaded in a thin column in modal dialogs is enough reason to not use it for serious reading or writing.

I guess that's a good point. I also thought about it a bit more and it wouldn't have as extensive modification history that a repo wiki would have.

Still, it's a shame, I kind of like the visual organization of topics and stuff.
 
Hey, has anyone here used Trello? A newcomer to my team introduced it to the 2-3 of us, and since our team is small and growing it did seem a good fit to keep better track of tasks we're doing.

We also need some form of documentation or knowledge-base for new people to read when they come in. I was thinking Trello could actually be pretty good for that, it can be like a wiki, anyone can edit or reorganize content, it's easy to glance over and see how things are categorized.

My teammates think a more traditional document wiki on our code repo is a better idea. I can see how keeping the docs more standard and attached to the code could be a good idea, but I'm kind of disappointed with the view 'that's not what Trello is for'. Any thoughts? Am I dumb for mis-using a tool?

I agree Tathanen, Trello is just not robust enough. You can easily manage a basic Kanban flow (to-do, doing, done) with it and then integrate it with other systems (such as tieing the cards to commits / wiki pages / etc etc).
 

Zakalwe

Banned
Working on a new build for my main site. This is what I have so far.

It's a rough template, still needs a lot of styling (typography, layout, etc...), but this is the general idea.

What do you think of it so far? What would you change? Is there any specific direction you'd take any particular section/aspect?

Thanks. :3
 
Working on a new build for my main site. This is what I have so far.

It's a rough template, still needs a lot of styling (typography, layout, etc...), but this is the general idea.

What do you think of it so far? What would you change? Is there any specific direction you'd take any particular section/aspect?

Thanks. :3

First thing that came into my mind was "oh god, not smooth scroll". Never screw with peoples scrolling.
 

Zakalwe

Banned
My project manager wants me to use jquery.nicescroll for a React SPA. I'm gonna quit before I touch that pile of garbage again


Again, what's the smooth scroll js script doing to the standard scroll? As far as I'm aware, it's only affecting the scroll-to links.

If not, could you explain what's happening and why it's bad?

If I disable the js file I see no difference to the base scrolling at all.
 
Again, what's the smooth scroll js script doing to the standard scroll? As far as I'm aware, it's only affecting the scroll-to links.

If not, could you explain what's happening and why it's bad?

If I disable the js file I see no difference to the base scrolling at all.

jquery.nicescroll replaces your scrollbar with a flashy div and intercepts your mousewheel to fuck with the scrolling feel you're used to on all websites.

I personally have no problem with your slow scrolling on anchors.
 

Zakalwe

Banned
jquery.nicescroll replaces your scrollbar with a flashy div and intercepts your mousewheel to fuck with the scrolling feel you're used to on all websites.

I personally have no problem with your slow scrolling on anchors.

Well, that sounds awful.

I meant the part PetriP-TNT was referring to, implying that the js file I'm using is messing with the base scroll. Was it just a misinterpretation of the file?
 

Somnid

Member
Again, what's the smooth scroll js script doing to the standard scroll? As far as I'm aware, it's only affecting the scroll-to links.

If not, could you explain what's happening and why it's bad?

If I disable the js file I see no difference to the base scrolling at all.

If it makes no difference why include at all? It seems you've introduced page weight and a possible performance bottleneck for no reason.
 

grmlin

Member
Why do you need a library, thats about 3kb, for that? Use jQuery.animate with the scrollTop property, it's a one-liner.


Anyway, scrolling smoothly to an anchor is fine. Messing with the native scroll behavior of the browser is a no-go. Like these one pager, that overwrite scroll with some stupid "scroll a little to scroll to the next part of the page"-shit.
 
It's fine. I'll be honest, it's tough to keep reviewing your personal branding site because a lot of it is very subjective. It's your personal brand, so if you think it's an effective statement about your brand, then that's what matters. Seems like you change this thing every month to something else... so, if you want to change it, change it, if you don't leave it.


Anyway, scrolling smoothly to an anchor is fine. Messing with the native scroll behavior of the browser is a no-go. Like these one pager, that overwrite scroll with some stupid "scroll a little to scroll to the next part of the page"-shit.

Completely agree here. It's very frustrating when clients request it. I hate anything that hijacks my scrolling behavior, and I'm also strongly against presenting content in some paralax scrolling effect because as a content consumer I never know if I'm at "100% content visibility." Fuck, on the web, the very concept of percentages of content visibility just shouldn't be a thing.
 

grmlin

Member
It's fine. I'll be honest, it's tough to keep reviewing your personal branding site because a lot of it is very subjective. It's your personal brand, so if you think it's an effective statement about your brand, then that's what matters. Seems like you change this thing every month to something else... so, if you want to change it, change it, if you don't leave it.




Completely agree here. It's very frustrating when clients request it. I hate anything that hijacks my scrolling behavior, and I'm also strongly against presenting content in some paralax scrolling effect because as a content consumer I never know if I'm at "100% content visibility." Fuck, on the web, the very concept of percentages of content visibility just shouldn't be a thing.

Biggest problem with the scrolling is: you can't do it right. It's always a janky mess.


regarding the site: on my Desktop (1920px wide) the content won't fit if the browser window isn't high enough. And I don't like the font, but thats completely subjective. :)
 

Zakalwe

Banned
It's fine. I'll be honest, it's tough to keep reviewing your personal branding site because a lot of it is very subjective. It's your personal brand, so if you think it's an effective statement about your brand, then that's what matters. Seems like you change this thing every month to something else... so, if you want to change it, change it, if you don't leave it.

This is a process. I re-design it when a I learn a little more about UX/UI, typography, layout (this is the first to use flex boxes, for example).

Any feedback is welcome. If you can't think of anything that's fine. Someone might so I may as well ask.

Why do you need a library, thats about 3kb, for that? Use jQuery.animate with the scrollTop property, it's a one-liner.

Because, as far as I'm aware, that makes the scroll happen at a lower frame rate and doesn't look as pretty. Hence the smoothscroll.js.

Unless I'm missing something here?

And for a site my size, I'm not overly concerned about a 3kb file.
 

grmlin

Member
This is a process. I re-design it when a I learn a little more about UX/UI, typography, layout (this is the first to use flex boxes, for example).

Any feedback is welcome. If you can't think of anything that's fine. Someone might so I may as well ask.



Because, as far as I'm aware, that makes the scroll happen at a lower frame rate and doesn't look as pretty. Hence the smoothscroll.js.

Unless I'm missing something here?

And for a site my size, I'm not overly concerned about a 3kb file.

Yeah, they are using the same old trick, animating the scrollTop property. I don't think there is another way (that uses the native scroll bar).

https://github.com/kswedberg/jquery-smooth-scroll/blob/master/src/jquery.smooth-scroll.js#L246

If you don't care for bloat in your side, it does not matter though, of course ;)
 

Zakalwe

Banned

grmlin

Member
I only said it because you asked for opinions. And as I'm not a designer these things are of my interest :D

It's always a good idea to look into the libraries used in a project. Sometimes it's not practical of course if the lib is too large, but smaller plugins are always good for a 5 minute tour :)
 

Zakalwe

Banned
I only said it because you asked for opinions. And as I'm not a designer these things are of my interest :D

It's always a good idea to look into the libraries used in a project. Sometimes it's not practical of course if the lib is too large, but smaller plugins are always good for a 5 minute tour :)

Absolutely agree. To be honest, I've been using the file for awhile and after initial setup I forgot to take another look once I'd learnt enough js to understand it.

I'll see if I can extract the exact part I need, or even learn how to write my own simpler version.
 

Ikuu

Had his dog run over by Blizzard's CEO
Learn how to bundle your files, no need to have like 7 different calls also run your page through PageSpeed and look at the issues it flags.
 

Somnid

Member
Well, if there's a more direct/succinct way to get the same effect, I'm definitely interested.

I'll look into this later, thanks grmlin.

There is a proposal for options on the Element.prototype.scrollIntoView method.

Code:
element.scrollIntoView({ behavior: "smooth" })

Only firefox supports it currently but that would be it if it ever gets more vendors to adopt it.
 

Zakalwe

Banned
Learn how to bundle your files, no need to have like 7 different calls also run your page through PageSpeed and look at the issues it flags.

Absolutely. This is all in development, nothing's optimized yet while I'm still. Changing not things. All that will be done at the end.

There is a proposal for options on the Element.prototype.scrollIntoView method.

Code:
element.scrollIntoView({ behavior: "smooth" })

Only firefox supports it currently but that would be it if it ever gets more vendors to adopt it.

I'll play around with this later. Thank you.
 

jokkir

Member
What a good resource (video or not) to learn about using the REST API? I need to learn more in this side of things but I'm not sure where to start. I don't even know what to do with the secret key that websites give you when requesting an api key :|
 
Top Bottom