Skip to content

Instantly share code, notes, and snippets.

@ahoward
Created May 8, 2012 16:06
Show Gist options
  • Save ahoward/2636753 to your computer and use it in GitHub Desktop.
Save ahoward/2636753 to your computer and use it in GitHub Desktop.
did i mention style is everything?
#
# perl got some things right. here-docs were one of them. YAML takes this
# further when we have to define large data structures.
#
# if you find yourself typing " ' ) ( [ ] too many times in a row, whack
# yourself on the wee-wee with a keyboard and whip out the YAML
#
this_fucking_licks_hairy_balls_to_edit =
[{"name"=>"Ara T. Howard", "email"=>"[email protected]"},
{"name"=>"Ryan Cook", "email"=>"[email protected]"},
{"name"=>"Garett Shulman", "email"=>"[email protected]"}]
and_this_does_not =
YAML.parse '
-
name : Ara T. Howard
email : [email protected]
-
name : Ryan Cook
email : [email protected]
-
name : Garett Shulman
email : [email protected]
'
@ahoward
Copy link
Author

ahoward commented May 14, 2012

moving the code lines separate from the delims is nice for editing....

@geeksam
Copy link

geeksam commented May 14, 2012

I tend to separate the delimiters even more, but that's probably just because TextMate's native indentation support isn't as robust as I wish it were.

I also tend to add a trailing comma after all hash or array entries, even the last one (Some of my coworkers took to calling it "the Livingston-Gray comma"). I like to reorder large hashes to group related keys together, and it sucks to wait 10 seconds for Rails to load and then get hit with a syntax error because I moved the last item up and forgot to add the comma. ;>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment