Skip to content

Instantly share code, notes, and snippets.

@macloo
macloo / dict_example.py
Created April 9, 2017 14:34
How Flask session variables work
# python 3
# a review of Python’s dictionary format
# create a new dict - named session - with three key:value pairs:
session = { 'logged_in': True, 'user': 'Harry Potter', 'password': 'parseltongue' }
# create a new dict - named session2 - with three key:value pairs
# another way to create a dict)
session2 = {}
session2['logged_in'] = False
@drgarcia1986
drgarcia1986 / tornado_asyncio.py
Last active August 7, 2021 15:57
Tornado and Asyncio Mixed example
# -*- coding: utf-8 -*-
import asyncio
import re
import asyncio_redis
import tornado.concurrent
import tornado.httpclient
import tornado.web
import tornado.platform.asyncio
@bootchk
bootchk / fileLoader.py
Created February 15, 2014 21:40
A class for asynchronous url loading using Qt, PyQt
'''
Copyright 2014 Lloyd Konneker
Release under the GPLv3
'''
from PyQt5.QtCore import pyqtSignal as Signal
from PyQt5.QtCore import QObject, QByteArray, QUrl
from PyQt5.QtNetwork import QNetworkAccessManager, QNetworkRequest
@kageurufu
kageurufu / flask.py
Created October 3, 2013 17:42
Flask-WTF FieldLists with Dynamic Entries
from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.wtf import Form
from flask.ext.babel import gettext
from wtforms import SelectField, TelField, TextField, FormField, Fieldlist, SubmitField
from wtforms.validators import Optional, Required
app = Flask(__name__)
db = SQLAlchemy(app)
@mreidsma
mreidsma / .htaccess
Created July 13, 2012 20:22
Simple click tracking script
// .htaccess
//
// Add this to the directory where your write.php will be stored
// This is an easy way to do an HTTP request to the script with the data
<IfModule mod_rewrite.c>
RewriteEngine On
# Change the following to the base directory of this file
RewriteBase /clickstats/