Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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:
Verifying that +pistachiopony is my openname (Bitcoin username). https://onename.io/pistachiopony
@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
@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

Once you have Hugo installed - type in terminal
hugo help
if you see the help options, all is good. Now create a folder in directory of choice
mkdir myBlog
cd into into your new folder
cd myblog
Now you can create your hugo blog by typing
hugo new site .
The . tells it to put it in the directory it is in,(but you can put another direct path if you like).
Open up your folder in your editor and you will see new folders there.
@PistachioPony
PistachioPony / Django Quickstart
Last active August 29, 2015 14:18
Django Quickstart
Assuming you have virtualenv,virtual wrapper, python and pip already installed.
$mkvirtualenv yourproject //this creates your project in a virtual environment
You will see you are in your virtualenv project because it will look like this -
(yourproject)yourcomputer~/desktop$
$pip install django // install django
$pip install django toolbelt
$django-admin.py startproject yourproject //this starts django off
Now cd into your new project folder
cd yourproject
Now get Core
@PistachioPony
PistachioPony / Go Quickstart
Created April 7, 2015 16:42
Go Quickstart
$ mkdir $HOME/mygo_projects
$ export GOPATH=$HOME/mygo_projects
$ go get github.com/gocraft/web
package main
import (
"fmt"
"labix.org/v2/mgo"
"labix.org/v2/mgo/bson"
"time"
)
type Person struct {