pip install requests-aws4auth
- Add
AWS_ACCESS_KEY_ID
,AWS_SECRET_ACCESS_KEY
,ELASTICSEARCH_INDEX_NAME
andELASTICSEARCH_HOST
variables to your environment - Import the variables to your settings file
- Add the
WAGTAILSEARCH_BACKENDS
configuration to your settings file
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
import React from 'react'; | |
class Ad extends React.Component { | |
/* | |
Usage in React JSX: | |
<Ad zoneId={'your zone id from Airserve'} /> | |
*/ |
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
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'], |
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
license: gpl-3.0 | |
height: 435 | |
border: no |
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
#!/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" |
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
<snippet> | |
<content><![CDATA[var $1 = (function() { | |
// $1 model | |
var self = null; | |
// ------------------------------------------------------------ | |
// constructor |
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
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'); |
Define templates using keys:
Template.register("event-detail",
'<div class="event-detail">' +
' <h2>{{ title }}</h2>' +
' <p>{{ description }}</p>' +
'</div>';
);
Call templates in code:
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
-- 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 | |
), |
NewerOlder