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
| # coding=utf-8 | |
| import flask | |
| from flask.ext.sqlalchemy import SQLAlchemy | |
| app = flask.Flask(__name__) | |
| app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///:memory:' | |
| app.config['SQLALCHEMY_ECHO'] = True | |
| db = SQLAlchemy(app) | |
| log_db = SQLAlchemy(app, session_options={ |
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
| # cd <PROJ_DIR> | |
| # PYTHONPATH=. python minimal_django_app.py runserver | |
| import os | |
| from django.conf.urls import patterns | |
| from django.http import HttpResponse | |
| filepath, _ = os.path.splitext(__file__) | |
| ROOT_URLCONF = os.path.basename(filepath) |
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
| <!DOCTYPE HTML> | |
| <html> | |
| <head> | |
| <style type="text/css"> | |
| #boxA, #boxB { | |
| } | |
| #boxA { background-color: #6633FF; width:75px; height:75px; } |
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
| /** | |
| * Sample React Native App | |
| * https://github.com/facebook/react-native | |
| * @flow | |
| */ | |
| import React, { Component } from 'react'; | |
| import { | |
| AppRegistry, | |
| StyleSheet, |
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
| /** | |
| * Created by k33g_org on 24/10/14. | |
| */ | |
| import mongodb from 'mongodb'; | |
| import uuid from 'node-uuid'; | |
| /* | |
| http://mongodb.github.io/node-mongodb-native/2.0/tutorials/crud_operations/ | |
| */ |
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 unittest | |
| from app import app | |
| from cStringIO import StringIO | |
| class UploadTest(unittest.TestCase): | |
| def setUp(self): | |
| self.app = app | |
| self.app.config['TESTING'] = True | |
| self.client = self.app.test_client() |
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 application.mail import mail_send | |
| ... | |
| SECURITY_SEND_MAIL_FUNCTION = mail_send | |
| ... | |
| FROM_EMAIL = 'dispatch@site.ru' | |
| FROM_NAME = u'Site Admin' |
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 gulp = require('gulp') | |
| var coffee = require('gulp-coffee'); | |
| var gutil = require('gulp-util'); | |
| var paths = { | |
| coffee: ['./src/**/*.coffee'] | |
| }; | |
| gulp.task('coffee', function() { | |
| gulp.src(paths.coffee) | |
| .pipe(coffee({bare: true}).on('error', gutil.log)) |
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
| /node_modules | |
| /build | |
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
| # source http://stackoverflow.com/questions/5870188/does-flask-support-regular-expressions-in-its-url-routing | |
| from flask import Flask | |
| from werkzeug.routing import BaseConverter | |
| app = Flask(__name__) | |
| class RegexConverter(BaseConverter): | |
| def __init__(self, url_map, *items): | |
| super(RegexConverter, self).__init__(url_map) | |
| self.regex = items[0] |