Skip to content

Instantly share code, notes, and snippets.

'use client';
import React, { ReactNode } from 'react';
import { useEffect } from 'react';
function useScrollHighlight() {
useEffect(() => {
const runHighlight = () => {
const params = new URLSearchParams(window.location.search);
const section = params.get('highlight');
if (!section) return;
@Atlessc
Atlessc / pull-iphone-data.js
Last active January 25, 2025 04:36
pull-iphone-data.js
const { execSync } = require("child_process");
var XLSX = require("xlsx");
const startTime = new Date();
// Function to calculate and format elapsed time
const getElapsedTime = () => {
const elapsed = new Date() - startTime;
const minutes = Math.floor(elapsed / 60000).toString().padStart(2, "0");
const seconds = Math.floor((elapsed % 60000) / 1000).toString().padStart(2, "0");
@Atlessc
Atlessc / map-project-structure.js
Created August 24, 2024 20:12
Map your web app project structure. it'll exclude the .env, .git, and the node_module folder.
import fs from 'fs';
import path from 'path';
function mapFiles(dir, excludedPaths = [], prefix = '', isLast = true) {
const items = fs.readdirSync(dir);
items.forEach((item, index) => {
const fullPath = path.join(dir, item);
const isExcludedPath = excludedPaths.includes(fullPath);
const isDirectory = fs.statSync(fullPath).isDirectory();