Skip to content

Instantly share code, notes, and snippets.

View gorkemozkan's full-sized avatar
🥰
work hard, be nice.

Görkem gorkemozkan

🥰
work hard, be nice.
  • PR Yazılım
  • İzmir
  • 04:55 (UTC +03:00)
View GitHub Profile
@gorkemozkan
gorkemozkan / memoize.js
Created September 18, 2023 19:24
Memoize
function memoize(callback) {
const cache = new Map();
return (...args) => {
const strArgs = String(args)
if (cache.has(strArgs)) {
return String(cache.get(strArgs));;
}
@gorkemozkan
gorkemozkan / pagination.js
Last active September 16, 2023 21:53
Pagination Helper
class PaginationHelper {
constructor(collection, itemsPerPage) {
this.collection = collection;
this.itemsPerPage = itemsPerPage;
}
itemCount() {
return this.collection.length;
}
pageCount() {
return Math.ceil(this.itemCount() / this.itemsPerPage);