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
import logging | |
from tastypie.authentication import Authentication | |
import oauth2 | |
from oauth_provider.consts import OAUTH_PARAMETERS_NAMES | |
from oauth_provider.store import store | |
from oauth_provider.store import Error as OAuthError | |
from oauth_provider.utils import get_oauth_request | |
from oauth_provider.utils import get_oauth_server |
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
class cached_property(object): | |
def __init__(self, func): | |
self.func = func | |
def __get__(self, obj, type=None): | |
if obj is None: | |
return self | |
obj.__dict__[self.func.__name__] = value = self.func(obj) | |
return value |
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
exports = exports ? @ | |
aform = {} | |
exports.aform = aform | |
aform.render_form_errors = ($form, fieldErrors, prefix='') -> | |
if prefix? | |
prefix = prefix += '-' | |
for name, errors of fieldErrors | |
$field = $ "#id_#{prefix}#{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
$(document).ajaxSend (event, xhr, settings) -> | |
getCookie = (name) -> | |
name += '=' | |
if document.cookie and document.cookie != '' | |
cookies = document.cookie.split ';' | |
for cookie in cookies | |
cookie = jQuery.trim cookie | |
# Does this cookie string begin with the name we want? | |
if cookie.substring(0, name.length) == name | |
return decodeURIComponent cookie.substring(name.length) |
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
import hashlib | |
from google.appengine.api import memcache, datastore_errors | |
from google.appengine.datastore.datastore_query import Cursor | |
from flask import request | |
from ndb import tasklets | |
class BasePager(object): | |
def __init__(self, **kwargs): |
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
import hashlib | |
import logging | |
from werkzeug import cached_property | |
from flask.signals import Namespace | |
from ndb import model, tasklets, query, key | |
from ndb.key import Key as BaseKey | |
class Error(Exception): |
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
""" | |
This gist adds url expiration functionality to flask-webassets on App Engine. | |
Few hints how to use it: | |
- Disable updater: ASSETS_UPDATER = False. | |
- Use AppEngineBundle instead of standard webassets Bundle. | |
- Rebuild assets manually: | |
* manage.py assets watch for development. | |
* manage.py assets rebuild for deployment. |
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
package main | |
import ( | |
"bytes" | |
"encoding/hex" | |
"flag" | |
"fmt" | |
"io" | |
"log" | |
"net" |
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
package main | |
import ( | |
"fmt" | |
"os" | |
"http" | |
"websocket" | |
) | |
type subscription struct { |
OlderNewer