Skip to content

Instantly share code, notes, and snippets.

@PistachioPony
PistachioPony / python_resources.md
Last active August 29, 2015 14:13 — forked from jookyboi/python_resources.md
Python-related modules and guides.

Packages

  • lxml - Pythonic binding for the C libraries libxml2 and libxslt.
  • boto - Python interface to Amazon Web Services
  • Django - Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
  • Fabric - Library and command-line tool for streamlining the use of SSH for application deployment or systems administration task.
  • PyMongo - Tools for working with MongoDB, and is the recommended way to work with MongoDB from Python.
  • Celery - Task queue to distribute work across threads or machines.
  • pytz - pytz brings the Olson tz database into Python. This library allows accurate and cross platform timezone calculations using Python 2.4 or higher.

Guides

@PistachioPony
PistachioPony / 0_reuse_code.js
Last active August 29, 2015 14:13
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
Verifying that +pistachiopony is my openname (Bitcoin username). https://onename.io/pistachiopony
@PistachioPony
PistachioPony / adding button to CMS
Created April 9, 2014 19:18
add button Python/Brubeck/mongo routes thru HTML
# In edit.html
<label>Card Count</label>
<div class="input-append">
<input class="span2" type="text" disabled="disabled" value="{{ player.card_count | int}}" id="card_count" >
<button class="btn" data-pk="{{ player._id }}" id="btn-card-count" type="button">Update</button>
</div>
#--------
# these were the old buttons:
@PistachioPony
PistachioPony / Routes and Templates Pymon
Last active August 29, 2015 13:58
Python & Mongrel2
# Understanding how it moves from route template
# The routes are on the cms_server.py
# The create.html is a big form. When you get to that page you are Get ing the page. GET bunt/player/create
# *** If there is no action= on the form then when you submit it will return to that page as a POST bunt/player/create
# <form method="post" enctype="multipart/form-data" accept-charset="utf-8">
# So as seen above the POST method on the form will route it to same place.
# create.html
<form method="post" enctype="multipart/form-data" accept-charset="utf-8">
@PistachioPony
PistachioPony / group routes
Created March 19, 2014 21:59
Getting to know my routes for groups
//routes
var async = require('async');
var _ = require('lodash');
var ObjectId = require('mongodb').ObjectID;
module.exports = function (app, models, config, messagebus, queue) {
//load modules
var validate = require('./validate');
@PistachioPony
PistachioPony / my group form.njs
Created March 19, 2014 19:29
my group form.njs
{% extends '/layouts/layout.njs' %}
{% block content %}
<div class="box ">
<aside class="container">
<div class="col col-1of1-xs">
<h1>Create a group</h1>
<br>
</div>
</aside>
@PistachioPony
PistachioPony / getting to know the form
Created March 19, 2014 19:26
gettting to know the form
{% extends '/layouts/layout.njs' %}
{% block contenttype%}item-form{%endblock%}
{% block content %}
{% if item.summary and item.title and (item.ship or item.exchange) and item.category and (item.images|length > 0) and (item.groups|length > 0) and (item.state != "open") %}
{% set isPublishable = 1 %}
{% else %}
{% set isPublishable = 0 %}
{% endif %}
@PistachioPony
PistachioPony / Modal to Route
Created March 11, 2014 15:17
Creating the modal html - routes
<!--In the Dashboard.njs-->
<div class="dashboard-item-offer box {{"invisible" if offer.isHidden}} {{"offer-to-rate" if offer.state == "rescinded" and not offer.ratedBySeller }}">
<div class="col col-1of4-md col-1of1-xs">
{% include "partials/userthumb.njs" %}
{% include "partials/modals/message.njs" %} *****This tells the button where to go
<div class="offerer">
<p class="offerer-name">{{offer.offerer.name}}</p>
<p class="offerer-location">{{offer.offerer.location.city}}, {{offer.offerer.location.state}}</p>
<a><button type="submit" class="bttn6 seller-message" data-toggle="modal" data-target="#modalSellerMessage"> Message</button></a>
@PistachioPony
PistachioPony / JS validation
Last active August 29, 2015 13:56
How the Validator Works
var mariaItem = function (req, res, next) {
Item.findOne({ _id: "5099803df3f4948bd2f98391"}, function (err, result){
req.contents = {};
req.contents.result = result;
next();
});
};
var mariaView = function (req, res, next){
async.waterfall([