30 seconds of code provides a curated collection of short code snippets for all your development needs. Our collection spans many topics, ranging from simple coding problems to theoretical concepts and development techniques.
JavaScript, Node
Creates a directory, if it does not exist.
JavaScript, Type
Checks if the given argument is a native boolean element.
JavaScript, Type
Checks if the given argument is a number.
JavaScript, Math
Calculates the logarithm of the given number in the given base.
JavaScript, Node
Loads a module after removing it from the cache (if exists).
JavaScript, Math
Sums all the numbers between 1
and n
.
Git, Commit
Creates a fixup commit that can be autosquashed in the next rebase.
Git, Branch
Displays the difference between two branches.
Python, Date
Calculates the date of n
days from the given date.
Python, Math
Clamps num
within the inclusive range specified by the boundary values.
Python, Math
Checks if the given number falls within the given range.
Python, Math
Checks if the provided integer is a prime number.
Python, String
Pads a given number to the specified length.
JavaScript, Browser
Checks if the given element is focused.
JavaScript, Browser
Checks if the browser tab of the page is focused.