Skip to content

Instantly share code, notes, and snippets.

View madzak's full-sized avatar

Zakaria Zajac madzak

View GitHub Profile
class CompanyWorkNotes(models.Model):
class Meta:
managed=False
oe_id = models.IntegerField(primary_key=True)
notes = models.TextField()
def __init__(self, company_id):
request = OeWebRequest("notes", "4242")
data = request.getData()
<h3>Work Notes</h3>
<form action="." method="post">
<table class="form">
{{ notesForm.as_table }}
</table>
<input name="notesForm" type="submit" value="Save Notes" />
{% csrf_token %}
</form>
class CompanyWorkNotesForm(forms.ModelForm):
class Meta:
model = CompanyWorkNotes
exclude = ('oe_id')
@madzak
madzak / gist:1260246
Created October 3, 2011 21:03 — forked from sleekslush/gist:1260184
Client-side smash markup
<html>
<head>
<link rel="stylesheet/wesumo" type="text/css" href="http://meyerweb.com/eric/tools/css/reset/reset.css" />
<link rel="stylesheet/wesumo" type="text/css" href="http://a.fsdn.com/sd/classic.css?release_20110818.02" />
<script type="text/javascript" src="wesumo.debug.js?key=po0eYa_0R9W1QZ8Q7BGRiw&smash=css"></script>
</head>
<body>
<span id="message">Smash that shit</span>
<script type="text/wesumoscript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.js"></script>
<script type="text/wesumoscript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.14/jquery-ui.js"></script>
class ActUserForm(forms.ModelForm):
user_status = ReadOnlyField()
activation_date = ReadOnlyField()
def __init__(self, *args, **kwargs):
super(ActUserForm, self).__init__(*args, **kwargs)
instance = getattr(self, 'instance', None)
if instance and instance.id:
self.fields['user_status'].initial = instance.get_user_status_display()
class AdminHostingForm(forms.ModelForm):
total_users = ReadOnlyField()
def __init__(self, *args, **kwargs):
super(AdminHostingForm, self).__init__(*args, **kwargs)
instance = getattr(self, 'instance', None)
self.fields['account_manager'] = forms.ChoiceField(required=False)
try:
accountManagers = OeUsers("datalogicaccountmgr")
#!/usr/bin/env python
import sys, random, re, urllib, urllib2, json
def process_msg(line):
image_me = re.compile("(image|im)( me)? (.*)", re.IGNORECASE).match(line)
animate_me = re.compile("animate me (.*)", re.IGNORECASE).match(line)
if image_me:
return fetch_image(image_me.group(3))
elif animate_me:
@madzak
madzak / Email Remark
Created January 31, 2012 17:41
Can we make this more offensive?
I think it is unreasonable to have a lower level engineer make design changes which violate the key design intent of the Senior Principal Enterprise architect and one of our most senior principals and I do not think we should proliferate multiple implementations.
@madzak
madzak / xcode_gems
Created October 8, 2012 18:48
Xcode Handy Snippets
# Show View Hicharchy
po [[UIWindow keyWindow] recursiveDescription]
@madzak
madzak / Blueprint with DB.txt
Created November 2, 2012 17:22
Blueprint with DB
#!/usr/bin/env python
# coding=utf8
from flask import Blueprint, current_app
from flask.ext.sqlalchemy import SQLAlchemy
app = current_app
db = SQLAlchemy(app)
class Block(db.Model):