Skip to content

Instantly share code, notes, and snippets.

View groue's full-sized avatar

Gwendal Roué groue

View GitHub Profile
@groue
groue / _documentation.md
Created September 23, 2012 12:21
GRMustache: reuse common layout templates
@groue
groue / Document.mustache
Created September 22, 2012 11:07
GRMustache: objects that render themselves
{{movie}}
@groue
groue / _documentation.md
Created September 22, 2012 11:04
GRMustache: variable tag that renders a dynamic partial
@groue
groue / Document.mustache
Created September 22, 2012 11:03
GRMustache: variable tag that expand into a template string
{{#movie}}
{{link}}
{{#director}}
by {{link}}
{{/director}}
{{/movie}}
super.mustache:
<html>
<head><title>{{{title}}}</title></head>
<body>
{{>navigation}}
<div class="content">
{{{content}}}
</div>
{{>footer}}
</body>
layout.mustache:
<html>
<head><title>{{{$yield title}}}</title></head>
<body>
{{>navigation}}
<div class="content">
{{{$yield}}}
</div>
{{>footer}}
</body>
// helper function for silentValueForKey
id silentValueForUndefinedKey(id self, SEL _cmd, NSString *key) {
return nil;
}
// The purpose of this function is to have the same result as
// [object valueForKey:key], but instead of letting [NSObject valueForUndefinedKey:]
// raise an NSUndefinedKeyException, it silently returns nil instead.
id silentValueForKey(id object, NSString *key) {
// Does object provide the same implementations of valueForKey: and valueForUndefinedKey: as NSObject?