Compact Code
@compact_code
Code snippets to help you make the most out of your programming language. Managed by @dylan_brookes and @ryanrossiter_
You might like
Javascript: Cool way to look at differences in Google Sheet cells.
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:
Javascript: Use the built-in reduce function to process a promise chain.
PHP: Extract attribute names as variables using the built-in extract function.
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.
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.
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.
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?
Javascript: Recursion and mapping. Can you figure out what the output is?
United States Trends
- 1. Clippers 14.3K posts
- 2. Harden 10.4K posts
- 3. Huda 9,953 posts
- 4. Ty Lue 1,527 posts
- 5. #hazbinhotelseason2 8,643 posts
- 6. #DWTS 50.3K posts
- 7. Kawhi 3,705 posts
- 8. Giannis 30.8K posts
- 9. #capcutai N/A
- 10. #RMxAPEC 212K posts
- 11. #RHOSLC 7,905 posts
- 12. Whitney 15.7K posts
- 13. Askarov N/A
- 14. South Korea 76.1K posts
- 15. Caden 8,550 posts
- 16. Joon 14.1K posts
- 17. Wayne 64.8K posts
- 18. Manola 5,836 posts
- 19. Zubac 1,722 posts
- 20. Jay Z 6,023 posts
Something went wrong.
Something went wrong.