{"id":20238875,"url":"https://github.com/khadem-mh/formulas","last_synced_at":"2025-10-24T20:42:14.897Z","repository":{"id":240372678,"uuid":"802447494","full_name":"khadem-mh/formulas","owner":"khadem-mh","description":"This page contains a variety of application formulas that are used in various projects that we develop frontend programmers ♥","archived":false,"fork":false,"pushed_at":"2024-08-13T13:23:36.000Z","size":61,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-14T01:16:25.871Z","etag":null,"topics":["formulas","javascript","js"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/khadem-mh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-18T10:17:24.000Z","updated_at":"2024-08-13T13:23:39.000Z","dependencies_parsed_at":"2024-05-18T11:40:55.274Z","dependency_job_id":"7fda00df-d479-432b-8252-8081058f0c08","html_url":"https://github.com/khadem-mh/formulas","commit_stats":null,"previous_names":["khadem-mh/formulas"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khadem-mh%2Fformulas","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khadem-mh%2Fformulas/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khadem-mh%2Fformulas/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khadem-mh%2Fformulas/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/khadem-mh","download_url":"https://codeload.github.com/khadem-mh/formulas/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241685832,"owners_count":20003103,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["formulas","javascript","js"],"created_at":"2024-11-14T08:36:00.511Z","updated_at":"2025-10-24T20:42:14.801Z","avatar_url":"https://github.com/khadem-mh.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# \u003cp align=\"center\"\u003e Hi👋\u003c/p\u003e\n\u003cp align=\"center\"\u003eThis page contains a variety of application formulas that are used in various projects that we develop frontend programmers ♥\n\u003c/p\u003e\n\n\u003cbr/\u003e\u003cbr/\u003e\n\n## \u003cimg src=\"https://img.shields.io/badge/-333333?style=flat\u0026logo=javascript\"\u003e `perspective2D-WhenHoverBox.js`\n```javascript\nconst boxes = document.querySelectorAll('.article__link')\n\nboxes.forEach(box =\u003e {\n\n const handleMouseMove = (e) =\u003e {\n\n   const rect = box.getBoundingClientRect();\n   const x = e.clientX - rect.left;\n   const y = e.clientY - rect.top;\n   const centerX = rect.width / 2;\n   const centerY = rect.height / 2;\n   const rotateX = (y - centerY) / centerY * 10;\n   const rotateY = (x - centerX) / centerX * 10;\n\n   box.style.transform = `perspective(1000px) rotateX(${rotateX}deg) rotateY(${rotateY}deg)`\n }\n\n const handleMouseLeave = () =\u003e {\n   box.style.transform = `perspective(1000px) rotateX(0) rotateY(0)`\n }\n\n box.addEventListener('mousemove', handleMouseMove)\n box.addEventListener('mouseleave', handleMouseLeave)\n\n return () =\u003e {\n   box.removeEventListener('mousemove', handleMouseMove)\n   box.removeEventListener('mouseleave', handleMouseLeave)\n }\n\n})\n```\n\n## \u003cimg src=\"https://img.shields.io/badge/-333333?style=flat\u0026logo=javascript\"\u003e `randomChooseItemFromArray.js`\n```javascript\nconst randomChooseItemFromArray = (arr, randomCount) =\u003e {\n    const shuffled = arr.sort(() =\u003e .5 - Math.random())\n    return shuffled.slice(0, randomCount)\n}\n```\n\n## \u003cimg src=\"https://img.shields.io/badge/-333333?style=flat\u0026logo=javascript\"\u003e `scrollHorizontal.js`\n```javascript\nlet customScroll = document.getElementById('scroll')\n\nconst scrollHorizontal = () =\u003e {\n    let scrollPercent = window.scrollY / (document.body.clientHeight - window.innerHeight)\n    let scrollPercentRoundede = Math.round(scrollPercent * 100)\n    customScroll.style.width = scrollPercentRoundede + '%'\n}\n\nwindow.addEventListener('scroll', scrollHorizontal)\n```\n\n## \u003cimg src=\"https://img.shields.io/badge/-333333?style=flat\u0026logo=javascript\"\u003e `concatinationArray.js`\n```javascript\nlet arr1 = [1, 2, 3, 4, 5]\nlet arr2 = [6, 7, 8, 9, 10]\n\nlet concatNumsArray = [...arr1, ...arr2]\n```\n\n## \u003cimg src=\"https://img.shields.io/badge/-333333?style=flat\u0026logo=javascript\"\u003e `sortingArray.js`\n```javascript\nlet arr1 = [2, 6, 1, 4, 7, 0, 3, 9, 10, 5, 8]\nlet numsArrSort = arr1.sort((a, b) =\u003e { return a - b })\n```\n\n## \u003cimg src=\"https://img.shields.io/badge/-333333?style=flat\u0026logo=javascript\"\u003e `determinationCountNumber.js`\n```javascript\nlet arr1 = [2, 6, 1, 4, 7, 0, 3, 7, 9, 10, 5, 8, 5, 2]\n\nlet numberReapet = numsArrSort.reduce((prev, current) =\u003e {\n    return { ...prev, [current]: (prev[current] || 0) + 1 }\n}, {})\n\nfor (let num in numberReapet) {\n    nums += ` ${num} `\n    console.log(nums);\n}\n```\n\n## \u003cimg src=\"https://img.shields.io/badge/-333333?style=flat\u0026logo=javascript\"\u003e `findMaxNumber.js`\n```javascript\nlet arr1 = [2, 6, 1, 4, 7, 0, 3, 7, 9, 10, 5, 8, 5, 2]\n\nlet maxNumber = arr1.reduce((prevNum, currentNum) =\u003e {\nif (prevNum \u003c currentNum) return currentNum\nelse return prevNum\n}, 0)\n```\n\n## \u003cimg src=\"https://img.shields.io/badge/-333333?style=flat\u0026logo=javascript\"\u003e `findMinNumber.js`\n```javascript\nlet arr1 = [2, 6, 1, 4, 7, 0, 3, 7, 9, 10, 5, 8, 5, 2]\n\nlet minNumber = arr1.reduce((prevNum, currentNum) =\u003e {\nif (prevNum \u003e currentNum) return currentNum\nelse return prevNum\n}, 0)\n```\n\n## \u003cimg src=\"https://img.shields.io/badge/-333333?style=flat\u0026logo=javascript\"\u003e `getOutAreaBox.js`\n```javascript\nlet getPositionElem = boxElem.getBoundingClientRect()\n\nif (\n    event.clientY \u003c getPositionElem.top ||\n    event.clientY \u003e (getPositionElem.top + getPositionElem.height) ||\n    event.clientX \u003e (getPositionElem.left + getPositionElem.width) ||\n    event.clientX \u003c getPositionElem.left\n) {\n    console.log('outside');\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkhadem-mh%2Fformulas","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkhadem-mh%2Fformulas","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkhadem-mh%2Fformulas/lists"}