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
var james = require('james'); | |
module.exports = function(options) { | |
return james.createStream(function(file, callback) { | |
callback(options.compiler.compile(file, options)(options.context)); | |
}); | |
}; |
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
#!/usr/bin/env node | |
var notifier = require('node-notifier'); | |
var stdin = process.openStdin(); | |
stdin.setEncoding('utf8'); | |
stdin.on('data', function(chunk) { | |
notifier.notify({message: chunk}); | |
}); |
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
$ ping cdn.jsdelivr.net | |
PING 531151672.r.worldcdn.net (94.254.0.25): 56 data bytes | |
64 bytes from 94.254.0.25: icmp_seq=0 ttl=55 time=31.281 ms | |
64 bytes from 94.254.0.25: icmp_seq=1 ttl=55 time=29.416 ms | |
64 bytes from 94.254.0.25: icmp_seq=2 ttl=55 time=31.258 ms | |
64 bytes from 94.254.0.25: icmp_seq=3 ttl=55 time=28.973 ms | |
64 bytes from 94.254.0.25: icmp_seq=4 ttl=55 time=28.925 ms | |
64 bytes from 94.254.0.25: icmp_seq=5 ttl=55 time=31.554 ms | |
64 bytes from 94.254.0.25: icmp_seq=6 ttl=55 time=31.247 ms | |
64 bytes from 94.254.0.25: icmp_seq=7 ttl=55 time=34.498 ms |
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
.container | |
h1.header | |
ul.items | |
li | |
a.name | |
.empty |
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
var context, directives; | |
context = { | |
"header": "Colors", | |
"items": [ | |
{"name": "red", "first": true, "url": "#Red"}, | |
{"name": "green", "link": true, "url": "#Green"}, | |
{"name": "blue", "link": true, "url": "#Blue"} | |
], | |
"empty": false |
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
var ctx = { | |
name: 'jude' | |
}; | |
var tpl = "hey {{ name }}, don't make it bad"; | |
var res = tpl.replace(/\{\{([a-zA-Z ]*)\}\}/g, function(m, g) { | |
return ctx[g.trim()]; | |
}); | |
console.log(res); |
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
<h1>{{header}}</h1> | |
{{#items}} | |
{{#first}} | |
<li><strong>{{name}}</strong></li> | |
{{/first}} | |
{{#link}} | |
<li><a href="{{url}}">{{name}}</a></li> | |
{{/link}} | |
{{/items}} |
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
h1= header | |
for item in items | |
if item.first | |
li: strong= item.name | |
if item.link | |
li: a(href= item.url)= item.name | |
if empty | |
p The list is empty. |
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
{ | |
"header": "Colors", | |
"items": [ | |
{"name": "red", "first": true, "url": "#Red"}, | |
{"name": "green", "link": true, "url": "#Green"}, | |
{"name": "blue", "link": true, "url": "#Blue"} | |
], | |
"empty": false | |
} |
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
var gt = partialize(function(a, b) { | |
return a < b; | |
}, 2); | |
function partialize(fn, amount) { | |
return function() { | |
return partial(fn, arguments); | |
} | |
}; |