Skip to content

Instantly share code, notes, and snippets.

View akramsaouri's full-sized avatar
🦄
Open for OSS contributions

Ak Ram akramsaouri

🦄
Open for OSS contributions
View GitHub Profile
@akramsaouri
akramsaouri / useStatus.js
Last active September 8, 2020 15:25
⚛️ No more isLoading or hasErrored
// @flow
import { useReducer } from 'react'
type AllowedStatus = 'idle' | 'processing' | 'error' | 'success'
const alllowedStatus = ['idle', 'processing', 'error', 'success']
type Status = {|
state: AllowedStatus,
/*
Josh's Custom CSS Reset
https://www.joshwcomeau.com/css/custom-css-reset/
*/
*, *::before, *::after {
box-sizing: border-box;
}
* {
margin: 0;
}
@akramsaouri
akramsaouri / kitsu-watchtime.js
Created February 4, 2025 08:40
Fetches and sums up the total hours you’ve spent watching anime from your Kitsu library
import fetch from 'node-fetch';
async function getTotalHoursWatched(userId) {
let page = `https://kitsu.io/api/edge/library-entries?filter[userId]=${userId}&include=anime&page[limit]=20`;
let totalMinutes = 0;
let totalEpisodes = 0;
const processedAnimeIds = new Set();
let nullAnimeDataCount = 0;
while (page) {
@akramsaouri
akramsaouri / hyper.js
Created March 11, 2025 20:25
Hyper js
"use strict";
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// choose either `'stable'` for receiving highly polished,
// or `'canary'` for less polished but more frequent updates
updateChannel: "stable",
// default font size in pixels for all tabs