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.
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.
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.
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.
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?
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 الاتجاهات
- 1. #SNME 28.8K posts
- 2. Georgia 46.7K posts
- 3. Lagway 3,713 posts
- 4. Drew 117K posts
- 5. Jade Cargill 12.2K posts
- 6. Jaire 9,383 posts
- 7. #UFCVegas110 8,427 posts
- 8. Forever Young 35.4K posts
- 9. #GoDawgs 5,381 posts
- 10. Gators 6,121 posts
- 11. Florida 75.3K posts
- 12. Tiffany 21.1K posts
- 13. Lebby 1,035 posts
- 14. Nigeria 579K posts
- 15. Gunner Stockton 1,091 posts
- 16. Shapen 1,062 posts
- 17. Salter N/A
- 18. #HailState 1,175 posts
- 19. Miami 59.9K posts
- 20. Howie 3,090 posts
Something went wrong.
Something went wrong.