Skip to content

Instantly share code, notes, and snippets.

View ronbeltran's full-sized avatar

Ronnie Beltran ronbeltran

View GitHub Profile

Install Python

$ brew install readline sqlite gdbm
$ brew install python --universal --framework
$ python --version
Python 2.7

Symlinks...

@ronbeltran
ronbeltran / webapp2_cheat_sheet
Created November 28, 2013 03:22
Google Appengine Webapp2 Framework Cheat Sheet
Get query strings
name = self.request.get('name', 'Anonymous')
members = self.request.get_all('members')
@ronbeltran
ronbeltran / gist:7701123
Last active March 2, 2020 09:57
Need to optimize
$CS2 = mysql_query("SELECT VID, AN FROM Cl WHERE VID = '$VID' ");
while( $row = mysql_fetch_array($CS2) ) {
$AN1 = $row['AN'];
$VID = $row['VID'];
$BA = 0;
$PA = 0;
$TB = 0;
$Ba = 0;
@ronbeltran
ronbeltran / gist:7764831
Last active December 30, 2015 02:49
Command line Kung Fu
To update appengine project on system with multiple accounts:
appcfg.py --no_cookies update <appname>
#For Postgres
initdb /usr/local/var/postgres -E utf8 # create a database cluster
postgres -D /usr/local/var/postgres # serve that database
PGDATA=/usr/local/var/postgres postgres # …alternatively
If builds of PostgreSQL 9 are failing and you have version 8.x installed,
you may need to remove the previous version first. See:
(android)
(areyoukiddingme)
(arrington)
(awyeah)
(basket)
(beer)
(bunny)
(bumble)
(cadbury)
(cake)
# -*- coding: utf-8 -*-
"""
A real simple app for using webapp2 with auth and session.
It just covers the basics. Creating a user, login, logout and a decorator for protecting certain handlers.
PRE-REQUIREMENTS:
Set at secret_key in webapp2 config:
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
// init the FB JS SDK
FB.init({
appId : 'YOUR_APP_ID', // App ID from the app dashboard
status : true, // Check Facebook Login status
xfbml : true // Look for social plugins on the page
});
@ronbeltran
ronbeltran / test.clj
Created December 8, 2013 15:14 — forked from adambard/test.clj
; Comments start with semicolons.
; Clojure is written in "forms", which are just
; lists of things inside parentheses, separated by whitespace.
;
; The clojure reader assumes that the first thing is a
; function or macro to call, and the rest are arguments.
;
; Here's a function that sets the current namespace:
(ns test)

Interactive Debugging in any Python Web Project

Ron DuPlain - PyOhio 2013

Turn this:

from django.db import models
from django.forms import ModelForm
from django import forms
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
from accounts.models import UserProfile
class UserProfileForm(ModelForm):
def __init__(self, *args, **kwargs):