Skip to content

Instantly share code, notes, and snippets.

View jrran90's full-sized avatar
🎯
Learn. Un-learn. Re-learn

Jhon jrran90

🎯
Learn. Un-learn. Re-learn
View GitHub Profile
@markthiessen
markthiessen / getWeeksInMonth.js
Last active January 29, 2024 01:00
JavaScript - get weeks in a month as array of start and end days
//note: month is 0 based, just like Dates in js
function getWeeksInMonth(year, month) {
const weeks = [],
firstDate = new Date(year, month, 1),
lastDate = new Date(year, month + 1, 0),
numDays = lastDate.getDate();
let dayOfWeekCounter = firstDate.getDay();
for (let date = 1; date <= numDays; date++) {
@6174
6174 / Random-string
Created July 23, 2013 13:36
Generate a random string in JavaScript In a short and fast way!
//http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript
Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);