Skip to content

Instantly share code, notes, and snippets.

@green3g
green3g / annotated stack
Last active January 3, 2017 18:55
sqlalchemy - must be string or buffer error message
[2017-01-03 11:20:20,026] {C:\\www\\flask_app\\virtualenv\\lib\\site-packages\flask\app.py:1587} ERROR - Exception on /api/util_tap [GET]
Traceback (most recent call last):
File "C:\\www\\flask_app\\virtualenv\\lib\\site-packages\flask\app.py", line 1988, in wsgi_app
response = self.full_dispatch_request()
File "C:\\www\\flask_app\\virtualenv\\lib\\site-packages\flask\app.py", line 1641, in full_dispatch_request
rv = self.handle_user_exception(e)
File "C:\\www\\flask_app\\virtualenv\\lib\\site-packages\flask_cors\extension.py", line 161, in wrapped_function
return cors_after_request(app.make_response(f(*args, **kwargs)))
File "C:\\www\\flask_app\\virtualenv\\lib\\site-packages\flask\app.py", line 1544, in handle_user_exception
reraise(exc_type, exc_value, tb)
{
"mapOptions": {
"showAttribution": true,
"extent": {
"xmin": -10384156.320134282,
"ymin": 5510189.79579398,
"xmax": -10382428.126698043,
"ymax": 5510998.356233742,
"spatialReference": {
"wkid": 102100,
@green3g
green3g / hybrid.py
Created November 4, 2016 17:08
flask restless hybrid filtering
import flask
import flask_sqlalchemy
import flask_restless
from sqlalchemy.ext.hybrid import hybrid_property
from sqlalchemy import event, select, func
from sqlalchemy.sql.expression import case
# Create the Flask application and the Flask-SQLAlchemy object.
app = flask.Flask(__name__)
app.config['DEBUG'] = True
define([
'dijit/form/Button',
'dojo/dom',
'dojo/i18n!./nls/main'
], function(Button, dom, i18n) {
var updateFeature = function(data) {
// get the feature layer
@green3g
green3g / search.js
Created October 11, 2016 13:15
A pretty interesting example of adding custom buttons to tmcgee's search widget
define([
'dojo/_base/lang',
'dojo/topic',
'tmcgee/Search',
'dijit/form/Button',
'./auth_util'
], function (lang, topic, Search, Button, Auth) {
var workorderButton = {
include: Auth.hasOneRole(['workorders_create', 'admin']),
@green3g
green3g / dojo.js
Last active February 19, 2017 12:08
SystemJS Dojo Loader
exports = {
fetch: function(load, fetch) {
console.log('load', load);
let module = load.name.split('!')[0];
return new Promise(function(resolve) {
//use dojo's require and then register the module
window.require([module], function(mod) {
System.register(module, [], function(exp, idObj) {
var result = {
setters: [],
@green3g
green3g / ModuleA.js
Created July 21, 2016 13:34
Circular dependency
import can from 'can';
import {B} from './ModuleB';
export let A = {
a: 1
};
export let ExtendedA = can.extend({}, A, {
a2: B
});
Edit Log Started at: 6/28/2016 8:06:00 AM
-----------------------------------------
Process Count: 0
Unwiring the events
#######################################################
storm_struc - ON_CREATE
Starting AA
***********************************************************
############ 6/28/2016 8:06:06 AM ################
10005 silly mapToRegistry uri https://registry.npmjs.org/options
10006 silly fetchNamedPackageData ultron
10007 silly mapToRegistry name ultron
10008 silly mapToRegistry using default registry
10009 silly mapToRegistry registry https://registry.npmjs.org/
10010 silly mapToRegistry uri https://registry.npmjs.org/ultron
10011 silly fetchNamedPackageData bufferutil
10012 silly mapToRegistry name bufferutil
10013 silly mapToRegistry using default registry
10014 silly mapToRegistry registry https://registry.npmjs.org/
mapOptions: {
basemap: "topo",
extent: new m({
xmin: -1.038891959E7,
ymin: 5505576.68,
xmax: -1.037829484E7,
ymax: 5517328.87,
spatialReference: {
wkid: 102100
}