Skip to content

Instantly share code, notes, and snippets.

View pielegacy's full-sized avatar

Alex Billson pielegacy

  • Mecca Brands
  • Melbourne, Australia
  • 05:33 (UTC -12:00)
View GitHub Profile
@pielegacy
pielegacy / Paginator First Attemp
Last active August 29, 2015 14:21
For Talfies <3
<div class="quotes-container">
@{
var items = Model.ToList(); //Getting Database Model and converting it to a list for easy operations
int maxpage = items.Count / 26; //Finding the max page (int floors the decimal place which helps)
int startpoint = items.Count() - 1;
if (page > 1)
{
startpoint -= 26 * (page - 1);
}
for (var i = startpoint; i >= items.Count() - 26 * page && i > 0; i--) //Basic For Loop printing the quotes to screen
@pielegacy
pielegacy / Create Term
Created April 6, 2015 21:46
IT Sharing
#New Element
@route('/create')
def create():
return template("create")
@route('/create', method="POST")
def success():
term = request.forms.get('term')
define = request.forms.get('define')
cat = request.forms.get('category')