Skip to content

Instantly share code, notes, and snippets.

View honnoretsu's full-sized avatar

SDE honnoretsu

View GitHub Profile
@honnoretsu
honnoretsu / restserver.py
Last active August 13, 2017 14:33
Hybrid rest and static files server using Flask
#!flask/bin/python
from flask import Flask, json, jsonify, make_response, request, abort, send_from_directory
from flask_cors import CORS, cross_origin
from flask_compress import *
from pprint import pprint
app = Flask(__name__, static_url_path='', static_folder='public')
cors = CORS(app, resources={r"/api/*": {"origins": "*"}})
servers = [
@honnoretsu
honnoretsu / notification.tag.html
Last active September 18, 2017 09:06
RiotJS basic notification tag through observables
<notification>
<div id="snackbar"></div>
<script>
/* USAGE:
create an observable:
var globalEvents = riot.observable();
And pull the trigger anywhere you need to:
globalEvents.trigger('notif_trigger', "Action done successfully");
*/
globalEvents.on('notif_trigger', function(data){