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
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| import json | |
| from flask import Flask, url_for | |
| from flask_sqlalchemy import SQLAlchemy | |
| """ | |
| Flask-SQLAlchemy many-to-many relationship using helper table | |
| http://flask-sqlalchemy.pocoo.org/2.1/models/ | |
| Hippies love their dogs. |
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
| # vim: set fileencoding=utf-8 : | |
| # | |
| # How to store and retrieve gzip-compressed objects in AWS S3 | |
| ########################################################################### | |
| # | |
| # Copyright 2015 Vince Veselosky and contributors | |
| # | |
| # Licensed under the Apache License, Version 2.0 (the "License"); | |
| # you may not use this file except in compliance with the License. | |
| # You may obtain a copy of the License at |
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
| real_ip_header X-Forwarded-For; | |
| real_ip_recursive on; | |
| set_real_ip_from 10.0.0.0/16; | |
| set_real_ip_from 54.192.0.0/16; | |
| set_real_ip_from 54.230.0.0/16; | |
| set_real_ip_from 54.239.128.0/18; | |
| set_real_ip_from 54.239.192.0/19; | |
| set_real_ip_from 54.240.128.0/18; | |
| set_real_ip_from 204.246.164.0/22; | |
| set_real_ip_from 204.246.168.0/22; |
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
| daemon off; | |
| worker_processes 1; | |
| events { worker_connections 1024; } | |
| http{ | |
| sendfile on; |
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
| .comPlainTextContentEditable { | |
| -webkit-user-modify: read-write-plaintext-only; | |
| } | |
| .comPlainTextContentEditable--has-placeholder::before { | |
| content: attr(placeholder); | |
| opacity: 0.5; | |
| color: inherit; | |
| cursor: text; | |
| } |
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
| { | |
| // http://eslint.org/docs/rules/ | |
| "ecmaFeatures": { | |
| "binaryLiterals": false, // enable binary literals | |
| "blockBindings": false, // enable let and const (aka block bindings) | |
| "defaultParams": false, // enable default function parameters | |
| "forOf": false, // enable for-of loops | |
| "generators": false, // enable generators | |
| "objectLiteralComputedProperties": false, // enable computed object literal property names |
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 alembic import context | |
| from sqlalchemy import engine_from_config, pool, MetaData, Table, ForeignKeyConstraint | |
| from logging.config import fileConfig | |
| # this is the Alembic Config object, which provides | |
| # access to the values within the .ini file in use. | |
| config = context.config | |
| # Interpret the config file for Python logging. |
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
| /* Useful celery config. | |
| app = Celery('tasks', | |
| broker='redis://localhost:6379', | |
| backend='redis://localhost:6379') | |
| app.conf.update( | |
| CELERY_TASK_RESULT_EXPIRES=3600, | |
| CELERY_QUEUES=( | |
| Queue('default', routing_key='tasks.#'), |
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
| var Promise = require('bluebird'); | |
| var promiseWhile = function(condition, action) { | |
| var resolver = Promise.defer(); | |
| var loop = function() { | |
| if (!condition()) return resolver.resolve(); | |
| return Promise.cast(action()) | |
| .then(loop) | |
| .catch(resolver.reject); |
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 cloudsearch import connect_cloudsearch, get_document_service | |
| endpoint = 'paste your doc service endpoint here' | |
| service = get_document_service(endpoint=endpoint) # Get a new instance of cloudsearch.DocumentServiceConnection | |
| # Presumably get some users from your db of choice. | |
| users = [ | |
| { | |
| 'id': 1, |