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
| # 21 lines, gutter at 80, for a fully functional coffeescript templater. | |
| global.compiledHTML = '' | |
| makeTagFunc = (tagName, isSelfClosing) -> | |
| (args...) -> | |
| selfEndingTag = if isSelfClosing then ' /' else '' | |
| attrs = args.filter((i) -> typeof i is 'object').reduce(((i, j) -> | |
| i + ("#{key}='#{val}'" for key, val of j).join ' '), '') | |
| inner = args.filter((i) -> | |
| typeof i != 'function' and typeof i != 'object').map((i) -> i).join ' ' | |
| global.compiledHTML += "<#{(tagName + ' ' + attrs).trim()}#{selfEndingTag}>" |
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
| /* Infinite stream of numbers! | |
| Format: `[number, suspendedStream]` where suspendedStream is really just a | |
| function that, upon calling, returns another `[number, suspendedStream]`. | |
| */ | |
| function head(a) { | |
| return a[0]; | |
| } | |
| function tail(a) { |
NewerOlder