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
from flask_rest_jsonapi.data_layers.alchemy import SqlalchemyDataLayer | |
from flask_rest_jsonapi.schema import get_relationships | |
class ImprovedRelationshipsDataLayer(SqlalchemyDataLayer): | |
""" | |
Improves SqlalchemyDataLayer by setting multiple | |
relationships without Sqlalchemy errors | |
""" |
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
Prismic.API(config.prismic.endpoint, {accessToken: config.prismic.accessToken}, function (error, api) { | |
api.query(Prismic.Predicates.at('document.type', 'project'), {'fetchLinks': 'client.name'}).then( function (projects) { | |
ctrl.projects = projects.results; | |
api.query(Prismic.Predicates.at('document.type', 'homepage')).then( function (homepage) { | |
ctrl.homepage = homepage.results[0]; | |
// Header Projects | |
var headerProjects = ctrl.homepage.getGroup('homepage.header_projects').toArray(); | |
// Get the full Project object for this link | |
_.forEach(headerProjects, function (headerProject) { |
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
{ | |
"Project" : { | |
"client" : { | |
"type" : "Link", | |
"fieldset" : "Details", | |
"config" : { | |
"placeholder" : "Client", | |
"select" : "document", | |
"customtypes" : [ "client" ] | |
} |
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
#!/usr/bin/env bash | |
# Put this file in the `bin` directory at the root of your project | |
source $BIN_DIR/utils | |
echo "-----> Starting corpora installation" | |
# Assumes NLTK_DATA environment variable is already set | |
# $ heroku config:set NLTK_DATA='/app/nltk_data' |
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 App extends Batman.App | |
@root 'students#index' | |
# Make App available in the global namespace so it can be used | |
# as a namespace and bound to in views. | |
window.App = App |
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
require('lib/setup') | |
Spine = require('spine') | |
$ = Spine.$ | |
Stages = require('controllers/main') | |
Stage = require('models/stage') | |
Question = require('models/question') | |
Profile = require('models/profile') | |
Leader = require('models/leader') | |
class App extends Spine.Controller |
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
require('lib/setup') | |
Spine = require('spine') | |
Stages = require('controllers/main') | |
Stage = require('models/stage') | |
class App extends Spine.Controller | |
constructor: -> | |
super | |
@stage = new Stages |
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 code is a suggested answer to question asked on Stackoverflow: | |
http://stackoverflow.com/questions/4827965/can-i-change-djangos-auth-user-username-field-to-be-100-chars-long-without-break/ |
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
#Taken from http://groups.google.com/group/django-users/browse_thread/thread/a743280fd76845e3# | |
class OfflineNotification(models.Model): | |
user = models.ForeignKey(User) | |
message = models.TextField() | |
level = models.PositiveSmallIntegerField(default=20) | |
created = models.DateTimeField(auto_now_add=True) | |
class OfflineNotificationsMiddleware: | |
def process_request(self, request): |