Skip to content

Instantly share code, notes, and snippets.

View rocktimsaikia's full-sized avatar
🚀
Shipping fast

Rocktim rocktimsaikia

🚀
Shipping fast
View GitHub Profile
@sindresorhus
sindresorhus / esm-package.md
Last active September 29, 2026 08:36
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@rocktimsaikia
rocktimsaikia / paginate.md
Last active January 14, 2021 15:31
🔥 How to paginate in mongodb using mongoose

🔥 Here is how to paginate in MongoDB using mongoose :

// Here it is hardcoded for example but 
// generally the `pageNum` should come from request query param
const pageNum = 2;
const pageSize = 10;

// pagination formula
const paginate = (pageNum - 1) * pageSize; 
@rocktimsaikia
rocktimsaikia / mongodb.md
Last active January 18, 2021 08:46
🔥 A tiny mongodb command cheatsheet for my personal use. Because I tend to forget them quite often

Common mongo shell commands/methods

show dbs : Show all the databases.
use <database> : switch/move into a database.
show collections : Show all the collections in that database.
db.<collection>.find() : Show all documents in the collection.
db.<collection>.help() : Show help on collection methods.
db.<collection>.drop() : Drops or removes completely the collection.
db.<collection>.deleteMany() : Delete documents from the collection.
db.dropDatabase(): Deletes a database.

@tykurtz
tykurtz / grokking_to_leetcode.md
Last active October 3, 2026 10:32
Grokking the coding interview equivalent leetcode problems

GROKKING NOTES

I liked the way Grokking the coding interview organized problems into learnable patterns. However, the course is expensive and the majority of the time the problems are copy-pasted from leetcode. As the explanations on leetcode are usually just as good, the course really boils down to being a glorified curated list of leetcode problems.

So below I made a list of leetcode problems that are as close to grokking problems as possible.

Pattern: Sliding Window

@dillonchanis
dillonchanis / example.css
Created September 20, 2020 14:44
Tailwind Utility for using gradients with text
@layer utilities {
.text-gradient {
background-clip: text;
-webkit-text-fill-color: transparent;
}
}
@chibicode
chibicode / README-Twemoji-React.md
Last active January 26, 2026 13:46
A dead simple React.js Twemoji component.

Twemoji + React

A dead simple React Twemoji component.

Requirements: twemoji

npm install --save twemoji
@qoomon
qoomon / conventional-commits-cheatsheet.md
Last active October 3, 2026 18:28
Conventional Commits Cheatsheet
@stasius12
stasius12 / countries.py
Created September 23, 2018 10:38
List of all timezones with name of country and country code
countries = [
{'timezones': ['Asia/Kabul'], 'code': 'AF', 'name': 'Afghanistan'},
{'timezones': ['Europe/Mariehamn'], 'code': 'AX', 'name': 'Aland Islands'},
{'timezones': ['Europe/Tirane'], 'code': 'AL', 'name': 'Albania'},
{'timezones': ['Africa/Algiers'], 'code': 'DZ', 'name': 'Algeria'},
{'timezones': ['Pacific/Pago_Pago'], 'code': 'AS', 'name': 'American Samoa'},
{'timezones': ['Europe/Andorra'], 'code': 'AD', 'name': 'Andorra'},
{'timezones': ['Africa/Luanda'], 'code': 'AO', 'name': 'Angola'},
{'timezones': ['America/Anguilla'], 'code': 'AI', 'name': 'Anguilla'},
{'timezones': ['Antarctica/Casey', 'Antarctica/Davis', 'Antarctica/DumontDUrville', 'Antarctica/Mawson', 'Antarctica/McMurdo', 'Antarctica/Palmer', 'Antarctica/Rothera', 'Antarctica/Syowa', 'Antarctica/Troll', 'Antarctica/Vostok'], 'code': 'AQ', 'name': 'Antarctica'},
@eneko
eneko / list-of-curl-options.txt
Last active September 21, 2026 01:16
List of `curl` options
$ curl --help
Usage: curl [options...] <url>
--abstract-unix-socket <path> Connect via abstract Unix domain socket
--alt-svc <file name> Enable alt-svc with this cache file
--anyauth Pick any authentication method
-a, --append Append to target file when uploading
--basic Use HTTP Basic Authentication
--cacert <file> CA certificate to verify peer against
--capath <dir> CA directory to verify peer against
-E, --cert <certificate[:password]> Client certificate file and password
@remy
remy / .eslintignore
Last active April 13, 2021 04:48
My Next.js eslint config + `npm install --save-dev eslint eslint-plugin-react babel-eslint`
.next
out