Skip to content

Instantly share code, notes, and snippets.

View Banhawy's full-sized avatar
🏠
Working from home

Adham El Banhawy Banhawy

🏠
Working from home
View GitHub Profile
@Banhawy
Banhawy / donut-spin.css
Last active March 29, 2019 09:17
[Donut spinner] Creates a donut spinner that can be used to indicate the loading of content. #CSS
@keyframes donut-spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
.donut {
display: inline-block;
function getRemainingTime(endDate){
// Time difference betwwen now and deadline in milliseconds
let timeDifference = Date.parse(endDate) - Date.parse(new Date())
let seconds = Math.floor( (timeDifference/1000) % 60 )
let minutes = Math.floor( (timeDifference/1000/60) % 60 )
let hours = Math.floor( (timeDifference *60*60) % 24 )
let days = Math.floor( timeDifference/ (1000*60*60*24) )
return `Countdown ${days} Days, ${hours} Hours, ${minutes} minutes, ${seconds} seconds`
}
@Banhawy
Banhawy / getStatusCode.js
Created February 19, 2021 00:08
A Google Sheets app script that takes a url and returns the resulting status code from requesting that url
function getStatusCode(url) {
var url_trimmed = url.trim();
// Check if script cache has a cached status code for the given url
var cache = CacheService.getScriptCache();
var result = cache.get(url_trimmed);
// If value is not in cache/or cache is expired fetch a new request to the url
if (!result) {
var options = {
@Banhawy
Banhawy / 0-README.md
Created October 17, 2024 23:56 — forked from infomiho/0-README.md
Using ShadCN with Wasp 0.12+

Using ShadCN with Wasp 0.12 and beyond

Note

We'll be loosly following the Vite instructions for ShadCN since Wasp is using Vite + React: https://ui.shadcn.com/docs/installation/vite We'll skip some of the steps since they don't apply or they are done differently with Wasp.

You won't be able to use the @ alias setup since it's not currently supported by Wasp. Because of this you'll need to adjust some imports when we generate components, but it should be fairly straightforward to do.

1. Enable TailwindCSS if you haven't already