Skip to content

Conversation

sreid
Copy link
Member

@sreid sreid commented May 9, 2011

I added a very simple recipe about how to embed javascript in your CoffeeScript. I'm pretty new to both CoffeeScript and pull requests, so feel free to let me know if I need to do something differently.

Thanks for your work,

Steven

dbrady added a commit that referenced this pull request May 9, 2011
added syntax/embedding_javascript
@dbrady dbrady merged commit 77ead1c into coffeescript-cookbook:master May 9, 2011
@dbrady
Copy link
Member

dbrady commented May 9, 2011

Steven, welcome aboard! This is great. You are the second person to join the contributors team! I'm not EXACTLY certain how this works, but I think it means you can do this to your repository:

git remote rm origin
git remote origin add git@github.com:coffeescript-cookbook/coffeescript-cookbook.github.com.git

And then do a git pull. You can now commit directly to the cookbook! With great power comes great abuse, so go nuts!

I have two quick suggestions for you: one, consider writing your snippets so that rather than popping an alert, the evaluate to something as an expression, then add a hashrocket on the line below to show what the return value would be. Example:

function greet(name) { retun "Hello "+name; }

Back to CoffeeScript

greet "Coffee"

=> "Hello Coffee"

The reason: One, simple style consistency. Two, I'm getting ready to write an automagic code checker that will load up and evaluate script code, and whenever it sees # => on a new line it will check the current evaluation to see if it matches, and if it doesn't it will flag that snippet as broken so we can find and fix bad recipes.

Second thing: Add yourself to the author's page! Welcome aboard! This is exciting!

@dbrady
Copy link
Member

dbrady commented May 9, 2011

Hah, loving the broken rendering style of the code snippet. Heh. All I did was change your alert to a return, and then add a => line below the call to greet "Coffee".

@sreid
Copy link
Member Author

sreid commented May 9, 2011

Thanks David. I've updated the recipe to what I believe you suggested so it will work with your code checker (great idea!). I was able to push successfully. I may not be a lot of help with the project, but will add things I learn as I work with CoffeeScript.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants