--- banner: "![[robot.gif]]" banner_icon: banner_lock: "true" banner_y: 0.8875 --- ```dataviewjs const apiKey = 'YOUR API KEY HERE'; const city = 'YOUR CITY, COUNTRY'; const units = 'metric'; async function getWeather() { const url = `https://api.openweathermap.org/data/2.5/weather?q=${city}&units;=${units}&appid;=${apiKey}`; try { const response = await fetch(url); if (!response.ok) throw new Error('Weather data fetch failed'); return await response.json(); } catch (error) { console.error('Error:', error); dv.paragraph("Unable to fetch weather data."); return null; } } function formatTime(unixTimestamp) { const date = new Date(unixTimestamp * 1000); return date.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' }); } async function renderWeather() { const data = await getWeather(); if (!data) return; const { main, weather, wind, sys, name } = data; const weatherIcon = `https://openweathermap.org/img/wn/${weather[0].icon}@2x.png`; const temperature = Math.round(main.temp); const feelsLike = Math.round(main.feels_like); const tempMin = Math.round(main.temp_min); const tempMax = Math.round(main.temp_max); const humidity = main.humidity; const windSpeed = Math.round(wind.speed); const description = weather[0].description.charAt(0).toUpperCase() + weather[0].description.slice(1); const sunrise = formatTime(sys.sunrise); const sunset = formatTime(sys.sunset); const weatherHtml = `
${description}
${temperature}°${units === 'metric' ? 'C' : 'F'}

${description}

Feels like: ${feelsLike}°

?️ Min: ${tempMin}° | Max: ${tempMax}°

? Humidity: ${humidity}%

? Wind: ${windSpeed} ${units === 'metric' ? 'm/s' : 'mph'}

? Sunrise: ${sunrise} | ? Sunset: ${sunset}

`; dv.el('div', weatherHtml, { cls: 'weather-container' }); } renderWeather(); ``` > [!multi-column] > > >[!blank] >**In the morning** > > ```tasks > >path regex matches /01 - Daily Storage/ > >heading includes In the morning > >hide task count > >hide backlink > >hide edit button > >hide postpone button > >hide recurrence rule > >due today > >hide due date > > > > ``` > > > [!blank] > > ```dataviewjs > >const now = new Date(), > >hours = now.getHours(), > >minutes = now.getMinutes(), > >seconds = now.getSeconds(), > >totalSecondsInDay = 24 * 60 * 60, > >currentSeconds = (hours * 3600) + (minutes * 60) + seconds, > >progress = (currentSeconds / totalSecondsInDay) * 100; > >let greeting = '', icon = '?'; > >if (hours < 12) {greeting = 'Good Morning'; > >ic} else if (hours < 8) {greeting = 'Good Afternoon'; ic > >else {greeting = 'Good Evening'; ic > >const dateStr = now.toLocaleDateString(); > >dv.paragraph( > >`
> linear-gradient(135deg, #2F4F4F, #1B262C); > >padding: 25px; border-radius: 20px; text-align: center; > >color: #fff; box-shadow: 0px 15px 25px rgba(0, 0, 0, 0.3);"> > >${greeting}, Lộc Phan! ${icon} > >

Today is ${dateStr}

> >
Current Time Progress:
> >
> >

${hours}:${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}

> >
`); > > ``` > > > [!blank|right] >>![[street.gif]] > [!multi-column] > >[!blank] > >```dataviewjs const now = new Date(), currentMonth = now.getMonth(), currentYear = now.getFullYear(), firstDay = new Date(currentYear, currentMonth, 1), lastDay = new Date(currentYear, currentMonth + 1, 0), totalDays = lastDay.getDate(), currentDay = now.getDate(), startDayOfWeek = (firstDay.getDay() + 6) % 7; let calendarHTML = `
? ${now.toLocaleString('default', { month: 'long' })} ${currentYear}
${["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"].map(day => `
${day}
`).join('')}
`; for (let i = 0; i < startDayOfWeek i++) { calendarHTML += `
`; } for (let day = 1; day <= totalDays; day++) { let day center; padding: 15px; border-radius: 10px; font-size: 12px; background-color: #2A3C44; display: flex; justify-content: center; align-items: center; transition: background-color 0.2s;`; if (day === currentDay) { day center; padding: 15px; border-radius: 10px; font-size: 12px; background-color: #4A90E2; color: white; font-weight: bold; display: flex; justify-content: center; align-items: center; transition: background-color 0.2s;`; } if ((startDayOfWeek + day - 1) % 7 === 0 && day !== 1) { calendarHTML += `
`; } calendarHTML += `
${day}
`; } calendarHTML += `
`; dv.paragraph(calendarHTML); >>``` > > >[!blank] > >**In the afternoon** > >```tasks > > path regex matches /01 - Daily Storage/ > >heading includes In the afternoon > >due today > >hide task count > >hide backlink > >hide edit button > >hide postpone button > >hide recurrence rule > >hide due date > > ``` > > >[!blank] > >**In the evening** > > ```tasks > > path regex matches /01 - Daily Storage/ > >heading includes In the evening > >due today > >hide task count > >hide backlink > >hide edit button > >hide postpone button > >hide recurrence rule > >hide due date > > ``` > [!multi-column|justify] > > > [!blank] > > ? **Achievement** >> ```dataview > > list > > from #Achievements > > sort file.mtime desc > > limit 5 > > ``` > >> [!blank] >> ✨ **Contacts** >> ```dataview >> table file.mtime as "Last Modified" >> from #Contact >> sort file.mtime desc >> limit 4 >> ``` > >> [!blank] >> ![[garden.gif]] > [!multi-column|justify] > > > [!blank] > > ? **Anatomy** >> ```dataview > > list > > from #Anatomy > > sort file.mtime desc > > limit 5 > > ``` > > > [!blank] > > ? **Books** > >```dataview > >List > >From #book > >sort file.mtime Desc > >limit 5 > >``` > > > [!blank] > > ?️‍♀️**Health & Fitness** >>```dataview > > List > > From #Health > > where file.name != "Book Template" > > sort file.name asc > > limit 4 >>``` > [!multi-column] > > [!blank] > >![[techman.gif]] > > > [!blank] ✨ **Recently Created** > > ```dataview > > table file.mtime as "Creation Date" > > from #Daily-notes > > where file.name != "Diary Template" > > sort file.mtime desc > > limit 8 > > ``` ```dataviewjs const startDate = new Date("2024-06-08"); const daysSinceStart = Math.floor((Date.now() - startDate.getTime()) / (1000 * 60 * 60 * 24)); const files = dv.pages(); const totalNotes = files.length; const allTags = files.flatMap(p => p.file.tags).distinct(); const totalTags = allTags.length; const books = files.filter(p => p.file.tags.includes("#book")); const totalBooks = books.length; dv.paragraph(`
? Obsidian Vault Stats

Tracking your journey with Obsidian since:

${daysSinceStart} days

? Notes

${totalNotes}

?️ Tags

${totalTags}

? Books

${totalBooks}

`); ```