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
const loadData = function loadData(){ | |
let deferred = $.Deferred(); | |
deferred.then((data) => console.log(data)); | |
deferred.resolve(mockData); | |
return deferred; | |
}; |
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 coverage | |
class coverall(object): | |
def __enter__(self): | |
self.coverage = coverage.coverage() | |
self.coverage.erase() | |
self.coverage.start() | |
def __exit__(self, exc_type, exc_val, exc_tb): |
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
# coding=utf-8 | |
from flask import request, Response | |
from peewee import * | |
from flask_peewee.rest import RestAPI | |
from models import * | |
class IntApi(RestAPI): | |
@property | |
def registry(self): |
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 gevent | |
from gevent import monkey | |
monkey.patch_all() | |
import os | |
import timeit | |
import sqlalchemy | |
import sqlalchemy.event | |
import sqlalchemy.pool | |
from sqlalchemy import Table, Column, Integer, String, MetaData |
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/jython | |
Jython 2.7.0 (default:9987c746f838, Apr 29 2015, 02:25:11) | |
[Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.7.0_60 | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> import sys | |
>>> sys.path.append('Jama-1.0.3.jar') | |
>>> from Jama import Matrix | |
>>> array = [[1,2,3],[4,5,6],[7,8,9]] | |
>>> A = Matrix(array) | |
>>> b = Matrix.random(3,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
# a benchmark script for gevent and redis-py | |
import gevent | |
from gevent import monkey | |
monkey.patch_all() | |
import timeit | |
import redis | |
import random | |
r = redis.StrictRedis(host='xxx', password='xxx') | |
r.flushall() |
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 import Flask, render_template | |
from flask_assets import Bundle, Environment | |
app = Flask('app') | |
app.config['JST_COMPILER'] = u'_.template' | |
app.config['JST_NAMESPACE'] = 'window.Templates' | |
app.config['JST_BARE'] = False | |
env = Environment() |
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
# coding:utf-8 | |
import os | |
import uuid | |
import errno | |
import flask | |
from werkzeug.exceptions import abort | |
from werkzeug.utils import secure_filename | |
from werkzeug.datastructures import FileStorage |
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 import Flask | |
from flask_peewee.db import Database | |
app = Flask(__name__) | |
DATABASE = { | |
'name': 'group_int.db', | |
'engine': 'peewee.SqliteDatabase', | |
'threadlocals': True, | |
} | |
app.config['DATABASE'] = DATABASE |
NewerOlder