compact_code's profile picture. Code snippets to help you make the most out of your programming language.
Managed by @dylan_brookes and @ryanrossiter_

Compact Code

@compact_code

Code snippets to help you make the most out of your programming language. Managed by @dylan_brookes and @ryanrossiter_

Javascript: Cool way to look at differences in Google Sheet cells.

I learn something new every day.



Javascript: setTimeout supports additional arguments that can be passed to the callback:

compact_code's tweet image. Javascript: setTimeout supports additional arguments that can be passed to the callback:

Python: Similar to list comprehension, you can use a generator expression to create an iterable object:

compact_code's tweet image. Python: Similar to list comprehension, you can use a generator expression to create an iterable object:

Javascript: Use the built-in reduce function to process a promise chain.

compact_code's tweet image. Javascript: Use the built-in reduce function to process a promise chain.

PHP: Extract attribute names as variables using the built-in extract function.

compact_code's tweet image. PHP: Extract attribute names as variables using the built-in extract function.

Python: How to create a lambda function in python.

compact_code's tweet image. Python: How to create a lambda function in python.

Javascript: Copy an array of numbers into an array of unique numbers by converting it into a set.

compact_code's tweet image. Javascript: Copy an array of numbers into an array of unique numbers by converting it into a set.

PHP: Turn an associative array into JSON using the built-in json_encode function.

compact_code's tweet image. PHP: Turn an associative array into JSON using the built-in json_encode function.

Python: Need to express large numbers in a readable format? Use underscores to help visualize magnitudes of large numbers.

compact_code's tweet image. Python: Need to express large numbers in a readable format? Use underscores to help visualize magnitudes of large numbers.

Javascript: Truncate arrays quickly using the following methods. Note that .slice() is faster than modifying .length.

compact_code's tweet image. Javascript: Truncate arrays quickly using the following methods. Note that .slice() is faster than modifying .length.

PHP: Try using the null coalescing operator instead of isset() to see if a variable exists.

compact_code's tweet image. PHP: Try using the null coalescing operator instead of isset() to see if a variable exists.

Python: iterate through lists at the same time using zip.

compact_code's tweet image. Python: iterate through lists at the same time using zip.

Javascript: Here's a quick way to swap values:

compact_code's tweet image. Javascript: Here's a quick way to swap values:

PHP: Create variables on the fly with explicit variable generation. What's the value of $variable_3?

compact_code's tweet image. PHP: Create variables on the fly with explicit variable generation. What's the value of $variable_3?

Python: use enumerate to keep track of current loop value. What's the output of this?

compact_code's tweet image. Python: use enumerate to keep track of current loop value. What's the output of this?

Javascript: Recursion and mapping. Can you figure out what the output is?

compact_code's tweet image. Javascript: Recursion and mapping. Can you figure out what the output is?

United States Trends

Loading...

Something went wrong.


Something went wrong.