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
#!/usr/bin/python | |
import psycopg2 | |
class database(object): | |
def __init__(self,database,table): | |
self.database = database | |
self.table = table | |
self.sql_do('create table if not exists '+self.table+' ( key TEXT,data TEXT)') | |
def sql_do(self, sql, *params): |
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 sqlite3 | |
class database(object): | |
def __init__(self): | |
self.filename = "help.db" | |
self.table = "help_data" | |
self.sql_do('create table if not exists '+self.table+' ( key TEXT,data TEXT)') | |
def sql_do(self, sql, *params): | |
self._db.execute(sql, params) | |
self._db.commit() |
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
class Graph: | |
def __init__(self): | |
self.nodes = set() | |
self.edges = defaultdict(list) | |
self.distances = {} | |
def add_node(self, value): | |
self.nodes.add(value) | |
def add_edge(self, from_node, to_node, distance): |
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 csv | |
from reportlab.platypus import Paragraph,SimpleDocTemplate | |
from reportlab.lib.styles import getSampleStyleSheet | |
from reportlab.graphics.charts.piecharts import Pie | |
from reportlab.lib.colors import brown,blue | |
from reportlab.graphics.charts.legends import Legend | |
from reportlab.graphics.shapes import Drawing | |
from reportlab.lib.colors import black | |
# THIS FUNCTION CALCULATES THE PERCENTILE |
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
// jQuery snippet for changing HTML form into JSON | |
(function ($) { | |
$.fn.serializeFormJSON = function () { | |
var o = {}; | |
var a = this.serializeArray(); | |
$.each(a, function () { | |
if (o[this.name]) { | |
if (!o[this.name].push) { o[this.name] = [o[this.name]]; } |
NewerOlder