Code Snippets

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.

  • Check if date is between two dates

    Checks if a date is between two other dates.

    JavaScript, Date · Oct 20, 2020

  • String is lowercase

    Checks if a string is lower case.

    JavaScript, String · Oct 20, 2020

  • String is uppercase

    Checks if a string is upper case.

    JavaScript, String · Sep 15, 2020

  • Number in range

    Checks if the given number falls within the given range.

    JavaScript, Math · Nov 1, 2020

  • Random boolean value

    Generates a random boolean value.

    JavaScript, Math · Jan 20, 2021

  • Shallow clone object

    Creates a shallow clone of an object.

    JavaScript, Object · Sep 15, 2020

  • Check if list has no duplicates

    Checks if all the values in a list are unique.

    Python, List · Jan 7, 2021

  • Average

    Calculates the average of two or more numbers.

    Python, Math · Nov 2, 2020

  • Days ago

    Calculates the date of n days ago from today.

    Python, Date · Oct 28, 2020

  • Date difference in days

    Calculates the day difference between two dates.

    Python, Date · Oct 28, 2020

  • Days from now

    Calculates the date of n days from today.

    Python, Date · Oct 28, 2020

  • Fibonacci

    Generates a list, containing the Fibonacci sequence, up until the nth term.

    Python, Math · Nov 2, 2020

  • Find key of value

    Finds the first key in the provided dictionary that has the given value.

    Python, Dictionary · Nov 2, 2020

  • Date is weekday

    Checks if the given date is a weekday.

    Python, Date · Nov 2, 2020

  • Date is weekend

    Checks if the given date is a weekend.

    Python, Date · Nov 2, 2020