Created
November 11, 2011 03:56
-
-
Save gonzedge/1357146 to your computer and use it in GitHub Desktop.
The joy of writing CoffeeScript
This file contains 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
class BuildUtils | |
combine_source_files: (callback) -> | |
self = @ | |
fs.readdir './src', (err, files) -> | |
self.error_handler err | |
content = new Array() | |
files = files.sort() | |
for file, index in files when file.indexOf('.') isnt 0 then do (file, index) -> | |
fs.readFile "./src/#{file}", 'utf8', (err, fileContent) -> | |
self.error_handler err | |
content[content.length] = fileContent | |
if index is files.length - 1 | |
callback content |
This file contains 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
class BuildUtils | |
combine_source_files: (callback) -> | |
self = @ | |
fs.readdir './src', (err, files) -> | |
self.error_handler err | |
content = new Array() | |
files = files.sort() | |
for file, index in files then do (file, index) -> | |
unless file.indexOf('.') is 0 | |
fs.readFile "./src/#{file}", 'utf8', (err, fileContent) -> | |
self.error_handler err | |
content[content.length] = fileContent | |
if index is files.length - 1 | |
callback content |
This file contains 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
for file, index in files when file.indexOf('.') isnt 0 then do (file, index) -> | |
# The code I want to run |
This file contains 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
for file, index in files then do (file, index) -> | |
unless file.indexOf('.') is 0 | |
# The code I want to run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment