Skip to content

Instantly share code, notes, and snippets.

View eddiegreysherman's full-sized avatar

Eddie Sherman eddiegreysherman

View GitHub Profile
@promto-c
promto-c / sqlite_schema_to_dbml.py
Created May 29, 2024 06:32
This Python script converts the schema of an SQLite database to DBML format. It exports the table definitions and foreign key relationships, allowing for easy visualization of the database structure using tools like dbdiagram.io.
"""
Copyright (C) 2024 promto-c
Permission Notice:
- You are free to use, copy, modify, and distribute this software for any purpose.
- No restrictions are imposed on the use of this software.
- You do not need to give credit or include this notice in your work.
- Use at your own risk.
- This software is provided "AS IS" without any warranty, either expressed or implied.
"""
@wonderb0lt
wonderb0lt / logic.py
Last active February 11, 2021 23:01
Very basic MongoEngine pagination
from math import ceil
class Pagination:
def __init__(self, items, page, per_page, total_items):
self.items = items
self.page = page
self.total_items = total_items
self.per_page = per_page
self.num_pages = int(ceil(total_items / float(per_page)))
@tomciopp
tomciopp / gist:1805852
Created February 12, 2012 02:25
Sinatra contact form
-------------------------------
The code for the contact form
-------------------------------
<div id='contact-box' class="group">
<div class="span6 clear">
<form action="/" method="post" class="well">
<label for="name">Your Name:</label>
<input type="text" name="name" class="span4" placeholder="John Smith...">
<label for="email">Your email address:</label>