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
""" | |
Support for running `python -m myapp`. | |
""" | |
from myapp.wsgi import main | |
if __name__ == "__main__": | |
main() |
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
<amp-pixel src="https://ssl.google-analytics.com/collect?v=1&tid=UA-12345678-1&t=pageview&cid=$RANDOM&dt=$TITLE&dl=$CANONICAL_URL&z=$RANDOM"></amp-pixel> | |
/* | |
* Required parameters: | |
* v = API version number (currently 1) | |
* tid = Google Analytics property identifier (UA-12345678-1) | |
* t = hit type | |
* cid = client id (you should implement this via cookie etc.) | |
* z = random string to bypass caching (amphtml generates this to $RANDOM variable) |
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
#!/bin/bash -x | |
# DESCRIPTION: The following UserData script is created to configure a Rackspace Cloud server | |
# with all the necessary things you might want. | |
# Recommended flavor is a minimum 4-8GB as the disk partitions for /tmp and /var/log are 4-8GB | |
# | |
# Can be used from CLI with nova or supernova | |
# example: | |
# supernova lincusa boot --image "Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM)" --flavor performance1-8 --key-name {YOUR_KEY} --user-data "ubuntu-init-script.sh" --config-drive true {YOUR_SERVER_NAME} | |
# |
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
# | |
# Vagrantfile for testing | |
# | |
Vagrant::configure("2") do |config| | |
# the Chef version to use | |
config.omnibus.chef_version = "11.4.4" | |
def configure_vbox_provider(config, name, ip, memory = 384) | |
config.vm.provider :virtualbox do |vbox, override| |
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
<?php | |
function addControllerMap($controllerMapCollection, $method = array('GET', 'POST'), $route = '*', $controllerMap = null) { | |
global $__controllerMaps; | |
// parse arguments | |
$args = func_get_args(); | |
switch (count($args)) { | |
case 1: | |
$controllerMap = $controllerMapCollection; |
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
//equivalent of "select count (distinct fieldName) from someTable" | |
db.someCollection.aggregate([{ $group: { _id: "$fieldName"} },{ $group: { _id: 1, count: { $sum: 1 } } } ]) |
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
function interval(duration, fn){ | |
var _this = this | |
this.baseline = undefined | |
this.run = function(){ | |
if(_this.baseline === undefined){ | |
_this.baseline = new Date().getTime() | |
} | |
fn() | |
var end = new Date().getTime() |