-
-
Save titanjer/5758320 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sam command helpers for acme-sac to avoid some manual | |
editing when converting Python to CoffeeScript. | |
Imperfect and incomplete, check manually after use. | |
1. Reduce indentation to half (4->2) | |
2. Remove colons at the end of common statements | |
3. Rename elif to else if | |
4. Change function definitions to arrow declarations | |
5. Change python ranges to array ranges | |
Edit ,x s/ / /g | |
Edit ,x s/(if|else|for|while) (.+)\:/\1 \2/ | |
Edit ,x s/elif/else if/ | |
Edit ,x s/def (.+)(\(.*\))\:/\1 = \2 ->/ | |
Edit ,x s/range\(([^ ]+)\)/\[0\.\.\.\1\]/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment