Skip to content

Instantly share code, notes, and snippets.

View Pustur's full-sized 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 / download-release-asset.js
Last active March 6, 2022 16:00
Downloads the release assets for a private repo (requires nodejs --experimental-fetch flag)
// Imports
const fs = require('node:fs');
require('dotenv/config');
// Variables
const owner = 'Pustur';
const repo = 'epic-store-bot';
// Init
@Pustur
Pustur / facebook.svg
Last active July 24, 2022 21:15
Heavily optimized monochromatic SVG logos
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Pustur
Pustur / unique-dom-elements.js
Last active April 3, 2019 20:33
JavaScript – Return an object of all the html tag names and the number of times they appear in the document
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 November 15, 2024 05:25
DailyUI – A list of every DailyUI design challenge

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 August 26, 2019 18:38
JavaScript – Convert a timestamp to a string "X days X hours X minutes X seconds X milliseconds". Useful to show elapsed time since [event]
function timestampToString(timestamp, useMilliseconds) {
const periods = {
day: 86400000,
hour: 3600000,
minute: 60000,
second: 1000,
millisecond: 1,
};
if (!useMilliseconds) {