Define templates using keys:
Template.register("event-detail",
'<div class="event-detail">' +
' <h2>{{ title }}</h2>' +
' <p>{{ description }}</p>' +
'</div>';
);
Call templates in code:
| -- Index hit rate | |
| WITH idx_hit_rate as ( | |
| SELECT | |
| relname as table_name, | |
| n_live_tup, | |
| round(100.0 * idx_scan / (seq_scan + idx_scan),2) as idx_hit_rate | |
| FROM pg_stat_user_tables | |
| ORDER BY n_live_tup DESC | |
| ), |
Define templates using keys:
Template.register("event-detail",
'<div class="event-detail">' +
' <h2>{{ title }}</h2>' +
' <p>{{ description }}</p>' +
'</div>';
);
Call templates in code:
| function Constructor(){ | |
| this.foo = 'foo'; | |
| // Needed for Private methods | |
| var self = this; | |
| // Private methods need to be placed inside the Constructor. | |
| // Doesn't perform as well as prototype methods (as not shared across instances) | |
| function private(){ | |
| console.log('I am private'); |
| <snippet> | |
| <content><![CDATA[var $1 = (function() { | |
| // $1 model | |
| var self = null; | |
| // ------------------------------------------------------------ | |
| // constructor |
| #!/bin/sh | |
| # Convert a regular django template to a project-template template | |
| # Usage: ./django_template_escape.sh filename | |
| # The file is edited in-place. | |
| sed -i '' "s/{%/openblock/g" "$1" | |
| sed -i '' "s/%}/closeblock/g" "$1" | |
| sed -i '' "s/openblock/{% templatetag openblock %}/g" "$1" | |
| sed -i '' "s/closeblock/{% templatetag closeblock %}/g" "$1" |
| license: gpl-3.0 | |
| height: 435 | |
| border: no |
| from __future__ import with_statement | |
| from fabric.api import * | |
| from fabric.operations import get | |
| from fabric.contrib.files import exists | |
| from contextlib import contextmanager | |
| import os | |
| env.roledefs = { | |
| 'web': ['server1.example.com', 'server2.example.com'], |
| import React from 'react'; | |
| class Ad extends React.Component { | |
| /* | |
| Usage in React JSX: | |
| <Ad zoneId={'your zone id from Airserve'} /> | |
| */ |
pip install requests-aws4authAWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, ELASTICSEARCH_INDEX_NAME and ELASTICSEARCH_HOST variables to your environmentWAGTAILSEARCH_BACKENDS configuration to your settings file