Skip to content

Instantly share code, notes, and snippets.

View eddiegreysherman's full-sized avatar

Eddie Sherman eddiegreysherman

View GitHub Profile
@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>