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
var socket; | |
if (window.location.protocol !== 'https:') { | |
socket = io.connect('http://' + document.domain + ':' + location.port + '/stream'); | |
} | |
else { | |
socket = io.connect('https://' + document.domain + ':' + location.port + '/stream'); | |
} | |
initSocketIO = function() { | |
$("input[data-table-id]").change(emitChange); |
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
@socketio.on("user presence", namespace = '/stream') | |
def first_event(message): | |
the_date = message['data']['the_date'] | |
name = "%s %s" % (current_user.first_name, current_user.last_name) | |
print "Connected 01 %s" % name | |
emit('broadcast user', {'data': {'user':name, 'date':the_date }}, broadcast = True) | |
@socketio.on("disconnect", namespace='/stream') | |
def user_left(): | |
print ("Disconnect detected - Recalling all users") |
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
@app.route('/notify-all', methods=['POST']) | |
def notify_all(): | |
if request.form.get('admin_key') == app.config['NOTIFY_KEY'] or current_user.has_role('admin'): | |
# https://api.gemini.com/v1/pubticker/ethusd | |
# { | |
# "ask": "977.59", | |
# "bid": "977.35", | |
# "last": "977.65", | |
# "volume": { | |
# "BTC": "2210.505328803", |
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 uses bar plots to compare the percentages of women (ShareWomen) from the 10 first and last rows of a sorted dataframe. | |
''' | |
import pandas as pd | |
import matplotlib as plt | |
%matplotlib inline |
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 file is part of a larger set of unit testing scripts that ensures an API works properly. The API that this file tests is mod_api uploaded here on my github account as a gist named __init__.py | |
# tests/test_api.py | |
import unittest | |
from tests.base import BaseTestCase | |
from app.models import db, User, Account, Location, Department, Room, Bracket, \ | |
ContainerType, Unit, ScanSet, Container | |
from flask_security import current_user |
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 is the __init__.py file of an API module for a system built using the Flask micro framework and the extension Flask-RESTful. | |
This file is only a small piece of a larger system and is only here partially to showcase coding ability and style. | |
There is another file here on my github account that implements unit testing for this API. | |
''' | |
from flask import Flask, Blueprint, request, url_for, \ | |
jsonify, current_app, g | |
from flask_restful import Resource, Api, reqparse |
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 requests | |
import urllib | |
import json | |
import base64 | |
class TrendGetter(): | |
@staticmethod | |
def get_trending_hashtags(): |
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 Blueprint, request, render_template, \ | |
flash, g, session, redirect, url_for, jsonify | |
from app import db | |
# Import models | |
from app.mod_auth.models import User | |
from app.mod_greg.models import Building, Floor, Suite, Visit, \ | |
Visitor, visitors | |
from app.mod_rep.forms import ReportForm |