Skip to content

Instantly share code, notes, and snippets.

Avatar
🏌️‍♀️
"There was a sequel. Wasn't as good"

Loris Bettazza Pustur

🏌️‍♀️
"There was a sequel. Wasn't as good"
View GitHub Profile
@Pustur
Pustur / unique-dom-elements.js
Last active Apr 3, 2019
JavaScript – Return an object of all the html tag names and the number of times they appear in the document
View unique-dom-elements.js
const uniqueDomElements = () =>
Array.from(document.querySelectorAll('*')).reduce(
(obj, { tagName }) => {
obj[tagName] = obj[tagName] + 1 || 1;
obj._total += 1;
return obj;
},
{ _total: 0 }
);
@Pustur
Pustur / daily-ui.md
Last active Nov 22, 2020
DailyUI – A list of every DailyUI design challenge
View daily-ui.md

All DailyUI Challenges

  1. Sign Up
  2. Credit Card Checkout
  3. Landing Page (above the fold)
  4. Calculator
  5. App Icon
  6. User Profile
  7. Settings
  8. 404 page
@Pustur
Pustur / timestamp-to-string.js
Last active Aug 26, 2019
JavaScript – Convert a timestamp to a string "X days X hours X minutes X seconds X milliseconds". Useful to show elapsed time since [event]
View timestamp-to-string.js
function timestampToString(timestamp, useMilliseconds) {
const periods = {
day: 86400000,
hour: 3600000,
minute: 60000,
second: 1000,
millisecond: 1,
};
if (!useMilliseconds) {
You can’t perform that action at this time.