Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@pebreo
pebreo / mysql.txt
Last active August 29, 2015 14:01 — forked from johnantoni/mysql.txt
username: vagrant
password: vagrant
sudo apt-get update
sudo apt-get install build-essential zlib1g-dev git-core sqlite3 libsqlite3-dev
sudo aptitude install mysql-server mysql-client
sudo nano /etc/mysql/my.cnf
change:
# http://stackoverflow.com/questions/14249115/serializing-output-to-json-valueerror-circular-reference-detected
from sqlalchemy import *
from sqlalchemy.orm import sessionmaker, scoped_session
from sqlalchemy.sql import text
def f():
print 'hello'
engine = create_engine('mysql://readonly:password@192.168.27.183:3306/efn')
Session = scoped_session(sessionmaker(bind=engine))
@pebreo
pebreo / index.html
Last active August 29, 2015 14:02
Bootstrap skeleton
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Document</title>
<link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.css">
<link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap-theme.min.css">
@pebreo
pebreo / datatables.py
Created June 23, 2014 02:10
Flask+MongoDB+DataTables
"""
http://datatables.net/forums/discussion/13679/working-code-for-server-side-paging-filtering-sorting-for-python-flask-mongodb
I wrote a python script for implementing server-side DataTables using python, flask, and mongodb. It works very well for me, so I thought I'd share the code for anyone that needs it. Below is the script generalized as a template for you guys.
by luv_tables
January 2013
"""
from collections import namedtuple
from pymongo import MongoClient
---
# ^^^ YAML documents must begin with the document separator "---"
#
#### Example docblock, I like to put a descriptive comment at the top of my
#### playbooks.
#
# Overview: Playbook to bootstrap a new host for configuration management.
# Applies to: production
# Description:
# Ensures that a host is configured for management with Ansible.
@pebreo
pebreo / gulpfile.js
Created March 19, 2015 21:15
Gulp+BrowserSync
//Based on gulpfile.js from Google Web Starter Kit.
//https://github.com/google/web-starter-kit
'use strict';
// Include Gulp & Tools We'll Use
var gulp = require('gulp');
var $ = require('gulp-load-plugins')();
var del = require('del');
var runSequence = require('run-sequence');
var browserSync = require('browser-sync');
@pebreo
pebreo / html-bootstrap.md
Last active August 29, 2015 14:22
Bootstrap3 + HTML

Overview

  • div and spans are grouping tags

  • class tags are mostly used for assigning styling to a div

  • class assigniments to an element are additive e.g. `class = 'class1 class2'``

  • the class definition in CSS file/block that's more bottom takes precedence over the one on top, e.g. :

.class2 {
  color: red;
@pebreo
pebreo / cheatsheet.md
Last active August 29, 2015 14:23
DjangoGirls Chicago Notes

DjangoGirls Tutorial Notes

Below are some notes taken from the DjangoGirls Chicago workshop.

Linux/MacOS-specific Commands

Command(Apple)+Space and search for Terminal

cd mydir # change directory
@pebreo
pebreo / payform.html
Created April 3, 2015 18:23
braintree-payment-example
<html>
<form id="checkout" method="post" action="{% url 'recurpayresult' %}">
{% csrf_token %}
<input type="text" name="first_name">
<input type="text" name="last_name">
<div id="dropin"></div>
<input type="submit" value="Pay $25"> <!-- braintree will use this $25 payment -->
</form>
<script src="https://js.braintreegateway.com/v2/braintree.js"></script>
@pebreo
pebreo / gulpfile.js
Last active October 10, 2015 22:22 — forked from soin08/gulpfile.js
//Based on gulpfile.js from Google Web Starter Kit.
//https://github.com/google/web-starter-kit
'use strict';
// Include Gulp & Tools We'll Use
var gulp = require('gulp');
var $ = require('gulp-load-plugins')();
var del = require('del');
var runSequence = require('run-sequence');
var browserSync = require('browser-sync');