We can achieve what is known as "template inheritance" in other template engines using the {{block}} tag. A {{block}} is a replaceable fragment inside a template. Here's an example:
- {{define "Base"}}
<p>A header</p>
{{block body}}
var http = require("http"), | |
url = require("url"), | |
path = require("path"), | |
fs = require("fs"), | |
mime = require("mime") | |
port = process.argv[2] || 8888; | |
http.createServer(function(request, response) { | |
var uri = url.parse(request.url).pathname |
#!/usr/bin/gorun | |
package main | |
import "os" | |
import "fmt" | |
import "strings" | |
import "go/doc" | |
import "go/token" | |
import "go/parser" |
package main | |
import ( | |
"encoding/xml" | |
"fmt" | |
"log" | |
) | |
const data = `<Note> | |
<To>Tove</To> |
###Answer by Jim Dennis on Stack Overflow
#Your problem with Vim is that you don't grok vi.
You mention cutting with yy and complain that you almost never want to cut whole lines. In fact programmers, editing source code, very often want to work on whole lines, ranges of lines and blocks of code. However, yy is only one of many way to yank text into the anonymous copy buffer (or "register" as it's called in vi).
The "Zen" of vi is that you're speaking a language. The initial y is a verb. The statement yy is a simple statement which is, essentially, an abbreviation for 0 y$:
0 go to the beginning of this line. y yank from here (up to where?)
package pong.imperative | |
sealed trait Event | |
class PongConnection { | |
def isConnected(): Boolean = sys.error("not implemented") | |
def readEvent(): Event = sys.error("not implemented") | |
def moveUp(): Unit = sys.error("not implemented") | |
def moveDown(): Unit = sys.error("not implemented") | |
def shootMissile(): Unit = sys.error("not implemented") |
package pong.functional | |
sealed trait Event | |
sealed trait Action | |
object Action { | |
case object MoveUp extends Action | |
case object MoveDown extends Action | |
case object ShootMissile extends Action | |
} |
// var: poor stylistic form, but no leakage | |
function foo() { | |
bar = 3; | |
if (true) { | |
var bar = 5; | |
} | |
} | |
// let: will leak an auto-global | |
function foo() { |
/* | |
not terribly difficult to predict which statements print what. | |
*/ | |
function foo() { | |
var a, b, c, d; | |
if (true) { | |
if (true) { | |
a = 1; |
package bcomposes.twitter | |
import twitter4j._ | |
object StatusStreamer { | |
def main(args: Array[String]) { | |
val twitterStream = new TwitterStreamFactory(Util.config).getInstance | |
twitterStream.addListener(Util.simpleStatusListener) | |
twitterStream.sample | |
Thread.sleep(2000) |