Finding Max Date in One Line In JavaScript

Earlier this week, I found a very interesting way of calculating the maximum dates from a set of dates with only one line of code. It came from this Stack Overflow answer. Here is a slightly modified version:

var dates = [
  new Date("2011/06/25"),
  new Date("2011/06/28"),
  new Date("2011/06/27"),
  new Date("2011/06/26")
];

var maxDate = new Date(Math.max.apply(null, dates));
console.log(maxDate);
// Tue Jun 28 2011 00:00:00 GMT-0400 (EDT)

Your results may be slightly different based on your timezone. This can be fixed with Date.UTC, but the purpose of the above is to show the most readable instead of adaptable solution.

This works firstly because dates are converted to the number of millesconds since 1 January 1970 (UNIX Epoch) when doing numerical or comparison operations. So:

console.log(new Date("2011/06/25") - new Date("2011/06/24"));
// 86400000 one day
console.log(1000 * 60 * 60 * 24);
// 86400000 milleseconds in one day

Secondly, Math.max takes a set of arguments to find the maximum of. So apply has to be used to send an array as a set of arguments into Math.max instead of doing a normal call.

Github Location: https://github.com/Jacob-Friesen/obscurejs/blob/master/2016/maxDate.js

submitted by anonymous

The exercise asked me to write a function that returned the min of two arguments, so I wrote one that returned the min of an array!  Its still pretty simple but it made me feel clever, maths always made me feel clever in school and now this does too, and since you ran out of submissions

function min(arr) {
….if (!Array.isArray(arr) || arr.length==0)
……..return;
….var lowest = arr[0];
….for (var i=1; i<arr.length; i++) {
……..if (arr[i] < lowest)
…………lowest = arr[i];
……..}
…..return lowest;
}

(the dots are for indentation cause I think tumblr removes spaces)

9

Watch The Founder of Girls Who Code Perfectly School Trevor Noah On Why Culture Makes Or Breaks Women In Tech

On The Daily Show with Trevor Noah guest Reshma Saujani, an Indian-American lawyer and politician, discussed the initiative to encourage young women and girls to pursue studies and careers the booming tech field, where they are falling behind. But there are two moments in a girl’s life where we can reverse the trend.

Gifs: The Daily Show/cc.com

Coding Masterpost

Hey buddies guess what??

I’ve brought you some awesome links that I have for learning how to code, computer science posts, and also various things about hacking. :p

CODING / COMPUTER SCIENCE


www.udemy.com

The best free and paid classes on the web. This is my go to site for learning something new.

app.pluralsight.com

$40 a month but the courses are top tier. You might find a free trial from microsoft dev essentials…

http://ocw.mit.edu/index.htm

Free MIT courses with video lectures, notes, and resources!!!

https://www.codecademy.com/learn

Perhaps the most famous site for learning how to code, this is must have for any aspiring computer scientist, web dev, or programmer. A smooth UI, dozens of courses, APIs, and fun quizzes if you decide to cough up a bit of money. $19 is crazy dirt cheap compared to some $200 courses out there on the web.

https://thenewboston.com/

Dubbed by its creator as the social network for programmers, TNB is a hotbed of hundreds of video tutorials for programming and computer science, as well as other disciplines like cooking.

http://www.tutorialspoint.com/codingground.htm

Another crazy important site for anyone serious about programming. You can find online terminals, IDEs, and tutorials for almost every popular language out there, from oCaml to lisp

http://codecombat.com/

Geared towards children, this is a good introudction to programming thinking and helps a younger audience get into the problem solving mindset.

http://www.codewars.com/dashboard

For users with some coding experience, codewars offers hundreds of challenges in various languages and help them build up their skills. Perfect for intermediate to master programmers.

https://www.codingame.com/start

This site is a bit geared towards new coders, it’s still fun and helps a ton in developing confidence.

http://jonisalonen.com/

Random blog that discusses some concepts regarding computer science. Worth a read if you’re ever lost and wanna just reflect on something.

http://howtonetwork.net/

https://www.howtonetwork.com/

Both the old and new sites are still up and provide their services for learning IT skills.

http://www.freeprogrammingresources.com/

RESOURCES FOR COMPILERS, DATABASES, FORUMS, and SO MUCH MORE TAKE A LOOK.

http://www.hloom.com/modern-resume-templates/

What good is a programmer if they can’t make a good resume to show off their skills? With these helpful templates you can impress your potential employer.

http://freecomputerbooks.com/

I haven’t used this so be cautious. Has a lot of ebooks.

http://i.imgur.com/i3jtrA0.jpg

Web development cheat sheet.

http://hackforums.net/showthread.php?tid=626170

Awesome intro to programming with links to projects.

http://www.elithecomputerguy.com/

Eli has a blog and also videos for various things.

http://www.net130.com/ccie/tech/Sybex%20-%20Cisco%20CCIE%20Book.pdf

CCIE book. Not sure if it’s open source. I’ll remove this link if requested.

https://www.codeschool.com/

pay money, learn to code. seems legit.

http://www.python-forum.org/

A forum for Python usrers! There are only a few sections but there are enough posts on here so if you haev a question, it might have already been asked.

http://www.dreamincode.net/

Another sweet forum that covers multiple topics.

http://forums.devshed.com/

A really popular forum! Lots of languages and users, dozens of topics.

http://www.codingforums.com/

Another large forum, perfect for any use.

http://www.programmingforums.org/

A freaking large factory of forums you will never find the same post twice.

http://www.gamedev.net/page/index.html

Lots of forums, jobs, and helpful resources all geared towards game development.

http://stackoverflow.com/

The most famous one imo. Be wary friend, don’t let your CS teacher find this in your browser history.

http://forum.codecall.net/

Resources, forums, tutorials, blow yourself out here.

https://openhatch.org/

Has some training missions and other stuff. Helps you find projects to work on.

https://codefights.com/

Put your skills to the test against AI or humans.

www.datacamp.com

Like big data? Well this site teaches you Python, the numpy library, and R.

https://www.edx.org/

Full of courses for anything.

http://www.exactas.org/modules/UpDownload/store_folder/1_-_COMPUTACION/Jonathan%20Bartlett%20-%20Programming%20From%20The%20Ground%20Up.pdf

handy book on progrmaming.

HACKING


http://null-byte.wonderhowto.com/

This is one of the BEST websites to learn about security and you can follow tutorials by real hackers and members of the IT field. With a strong community full of experienced authors, you will either flourish by using proper grammar or be mocked for asking “how do i hack gmail??”

www.hackerhighschool.org/home.html

PERFECT FOR HIGH SCHOOL STUDENTS INTERESTED IN CYBERSECURITY BUT HAVE NO IDEA WHERE TO START. I CANNOT STRESS HOW AWESOME THIS SITE IS.

allison.com

ANOTHER PERFECT SITE FOR LEARNING ANYTHING

http://null-byte.wonderhowto.com/how-to/links-help-you-hacking-0162359/

Small collection of resources for educating yourself on internet security.

http://directory.umm.ac.id/Networking%20Manual/Networking%20For%20Dummies%207%20Ed%202004.pdf

A must read for anyone with a desire to get into IT

http://cli.learncodethehardway.org/book/

Crash course on Command line.

https://www.cybrary.it/

Great if you cannot afford pricy online classes. Instructors know what they are talking about and despite a few poor quality videos, you will be supplied with helpful resources and forums.

https://evilzone.org/

One of the better forums out there for learning. Delve into it at your own risk.

https://v3rmillion.net/

ROBLOX hacking, general exploits, or just normal discussions. Roblox helped put me on my path to coding and I love how every day, millions of kids are being taught the ability of coding thanks to its studio.

https://www.hackthissite.org/pages/index/index.php

Lessons, challenges, forums, and resources all bundled in a site to hone your pentest skills.

http://www.enigmagroup.org/

Like hackthissite, but with a different UI

https://www.hellboundhackers.org/

Read the above

https://pentest-tools.com/home

Free pentest tools. Don’t use it for anything wrong.

https://www.defcon.org/

Hehe..we are in defcon 4..

https://picoctf.com/learn

Capture the Flag learning site. Amazing imo.

http://overthewire.org/wargames/

Another war games site. You get various challenges that are fun to solve ^.^

http://hakipedia.com/index.php/Hakipedia

Wikipedia but for security.

http://smashthestack.org/

Wargames.

http://www.wablab.com/

Compete against IT pros. Git rekt code-bug

http://academy.ehacking.net/courses/computer-hacking-forensics-investigation/

Explore this site a bit.

https://www.ethicalhacker.net/features/book-reviews/the-basics-of-rootkits-leave-no-trace

The link kinda gives it away.

https://github.com/mrrrgn/simple-rootkit/blob/master/README.md

Fun little project.

http://www.fuzzysecurity.com/tutorials.html

Professional blog that has tutorials and highly detailed information.

https://www.corelan.be/index.php/2009/07/19/exploit-writing-tutorial-part-1-stack-based-overflows/

Ahh read the above please!

https://trailofbits.github.io/ctf/index.html

A CTF guide. Pretty well written and has slides. Awesome resources. What else can I say?

http://www.securitysift.com/windows-exploit-development-part-1-basics/

Another swell blog.

http://www.thegreycorner.com/2010/01/beginning-stack-based-buffer-overflow.html

Woa..another..awesome blog..there are too many to count!

http://www.flexhex.com/docs/howtos/hex-editing.phtml

Hey kid? Wanna learn how to hex edit like a b0ss?

https://www.blackhat.com/presentations/bh-usa-03/bh-us-03-willis-c/bh-us-03-willis.pdf

Nice little pdf for forensics.

www.greyhathacker.net

A blog that’s a bit dated but has useful information.

xeuhack.com

Dated but useful blog.

www.cybersecuritycourse.co

haven’t tried this yet but it has great reviews.

www.censys.io

Search engine for data scientists.

http://www.techexams.net/forums/off-topic/51719-best-security-websites.html

Best sites to learn from.

http://resources.infosecinstitute.com/ebooks/

Awww yiss ebooks

http://bookboon.com/en/it-programming-ebooks

Might run into errors downloading books.

http://ebook-dl.com/

Full books that are virus free.

That’s all for now! Special thanks to everyone who suggested I make this!

So I was scrolling through SM’s EXO page coding html and let me tell u they have lots of things planned. This album might be in 4 languages or something if I’m reading this correctly, I keep seeing things like Album EN, Album JP, Album KR, Album ZH (I’m assuming this is Chinese.. zh….) 4x the money for 9x the members 36 versions? SM stop.

But also reading the back HTML of the page, no wonder it takes them forever to release something, all this coding must have been a serious pain. Bless u coding bro.

But I find cute things in their coding like for example 

I wonder if the coders send messages to each other but why are they sending it in English? I know HTML is usually done in English but if it’s behind a hidden section why bother? Either way, it’s cute.

In the HTML, there seems to be an explicit mention of a ‘teaser movie’ they left the URL space blank, so I can imagine something is going on behind the scenes soon to be revealed.

That’s all. 

3

Sticky Notes Tutorial

coded by yukoki & suggested by hyskoa-mourououu

A tutorial for how to add these sticky notes to your theme!! They’re draggable, you can add bold/italic/linked text, and you can close the sticky notes once per page refresh. This tutorial mainly involves a lot of copy-pasting, so it’s not too difficult. I don’t guarantee they’ll work on all blog themes because of conflicting scripts, though.

Keep reading

Computer science masterpost

Hey, guys. I’ve decided to make my first study masterpost. This contains great free online courses to improve your coding skills and broaden your knowledge or a guide for a newbie who wants to start learning cs. Many of this recommendations were sent to me by some big tech-companies to help me to prepare for the interviews. Generally, it would be a great addition to classes taken at college. 

Introduction

Object-oriented Programming Languages

Discrete math

Algorithms and data structures

Operating systems 

Parallel programming

Computer Science sub-fields 

3

Fluid

Interactive webtoy by David Li is a fun fluid dynamics simulator which lets you play around with various parameters - here is a video of it in action:

Fluid simulation is a GPU implementation of the FLIP method (with various additions). Particle rendering uses spherical ambient occlusion volumes. 

You can find out more and try it out for yourself here

Fix emojis on your blog

or replace them with better ones.

Ever wondered why emojis on your blog show up as Unicode from the desktop?

It’s because browser support for emoji rendering is still quite poor (like chrome on windows)

Mac users should support them usually, but you can replace them with better-looking ones.

This tutorial will add emoji support to your blog in a few lines of code.

Difficulty:  ●○○ (easy)

Keep reading

It’s summer, which means you probably have enough free time to do something for you. But sometimes you don’t want to just relax, watch your favorite tv show or read your favorite book. No, you want something more. You want to be productive and you want to show everyone that you are not a lazy studyblr owner (because everyone is clearly productive as hell).

Here is a little guide to sites, that will help you reach your goal and show everyone that you are the most productive of us.

(god, that sounded like a teleshopping ad)

CODECADEMY - If you want to learn to code, this is the site for you. From basics of HTML and CSS, to Java, Python or SQL. I used this to revise my html abilities and to teach myself some basics of SQL. It’s easy, it’s understandable and it’s fun. The best part? It’s free.

CODE SCHOOL- Also a site that helps you learn coding. This one is a little bit tricky. You only get access to 10 intro courses and then you have to pay (29$/mo is too much I think)

KHAN ACADEMY - You have heard of it, right? Math, science, economics, coding, history and many more in one site. You earn points as you watch videos/do the tasks and for the point you unlock a little cute characters for your avatar. You also have some test prep there, so if you want, you can check it out. Also, it’s free.

CRASH COURSE - We all know John Green. We also know that he is a youtuber. But did you know that he actually wants to teach you something? With his brother, he has this YT channel in which they teach things like physics, psychology, history, economics, biology and many more. I use it for econ, but I want to get into physics more, because I’ve had problems with it in school. The little - they have, that it’s fast. So fast that sometimes, if english is not your first language, you will have to pause it and jump back a little bit. I don’t have a problem with english at all, but this speed is like me in front of my class, trying to present something (okay, that was like 3 years ago, I learned how to slow down). DFTBA!

COURSERA - Courses from universities all over the world. Even Ivy League schools have their courses there. The courses are either self-paced, or start at some date and you have to meet the deadlines. I love the self-paced ones. Also, if you want a certificate of completition, you have to pay but, if you don’t care about that, it’s totally free. 

edX - Basically the second Coursera. Or is Coursera the second edX? Who knows.

DUOLINGO - Learn new languages or just keep practising the ones you already know. You probably knew about this one, right?

MEMRISE - A little bit different from duolingo. This site is great for vocabulary, but I don’t use it for anything else. But for revising and learning new words - this is the one to look for. Also, there is a SAT course with all the creepy words.

TED - This is not a site like any of the sites above. Here, you listen to some hella inspiring people that achieved something, and learn to look at things from a different angle. I love this, and you should too. Just find your topic, and enjoy.

BOOKBOON - FREE TEXTBOOKS! YAY! I use this when I want to download some books for econ/finance self-learning. I want to be prepared for my class next year (yay, I’m so excited to start econ classes). Really, go and check this out. You will love it.

I hope you will use this to fill your time with awesome things. If you know any other great sites, just add them to this list. 

With love,

lena.