Skip to content

Instantly share code, notes, and snippets.

@tkh44
tkh44 / Lead_Post_Data.py
Created September 20, 2011 20:19
Lead Post data
"""
Dates in the form of: "%m/%d/%Y"
Required fields:
'status': 'Lead-New'
'address_country': 'US'
'agree': 1
'isperson': 'T'
'globalsubscriptionstatus': '1'
"""
values = {
@tkh44
tkh44 / loadPage.js
Created October 28, 2011 15:15
loadPage
function loadPage(link) {
console.log('link: ' + link);
elements.content.html(values.loader).load(link + "/" + " #inside-content", function() {
document.title = elements.content.find('#product-name').text() + ' | ' + values.title;
formatPage();
});
}
@tkh44
tkh44 / main.js
Created November 7, 2011 17:32
Main JS file for site
library = function() {
var elements = {};
var values = {
searchHeight: null,
logoHeight: null,
selected: 'selected',
category: 'category',
open: 'open',
catSelected: 'cat-selected',
@tkh44
tkh44 / sample.txt
Created November 22, 2011 21:08
sample surgery schedule
Skin biopsy 15 23 45 90
Removal of benign lesion 25 38 75 150
Removal of malignant lesion 38 56 113 225
Flap graft repair/closure 188 281 563 1125
Thyroid 1 1 1 1
Excision of small cyst or tumor of thyroid 200 300 600 1200
Resection of thyroid, total or complete 350 525 1050 2100
Resection of thyroid, subtotal or partial 300 450 900 1800
Thyroidectomy, total or subtotal, for malignancy with radical neck dissection 500 750 1500 3000
Tonsils and Adenoids 1 1 1 1
@tkh44
tkh44 / format.py
Created November 22, 2011 21:57
Surgery Benefit Formatter
import fileinput
import sys
import re
filename = sys.argv[1]
def benefitFormat(matchobj):
print matchobj.group(0)
return '[benefit name=\"' + matchobj.group(0).rstrip() + '\"'
@tkh44
tkh44 / table.py
Created November 28, 2011 21:00
table parse
def parse(kwargs):
name = kwargs.get('name')
html = '<tr>\n'
html += '\t<th>{{ name }}</th>\n'
if kwargs.get('values'):
values = kwargs.get('values')
split_values = values.split(';')
@tkh44
tkh44 / views
Created December 5, 2011 16:50
ajax_upload
def ajax_upload( request ):
if request.method == "POST":
if request.is_ajax( ):
# the file is stored raw in the request
upload = request
is_raw = True
is_common = False
# AJAX Upload will pass the filename in the querystring if it is the "advanced" ajax upload
try:
filename = request.GET[ 'qqfile' ]
@tkh44
tkh44 / json.js
Created December 29, 2011 17:26
Reddit API response
{
"kind": "Listing",
"data": {
"modhash": "hezjl3f8aq8ac18c7b0f26e3f3cf0de2be9c2cfd189bbb925a",
"children": [{
"kind": "t3",
"data": {
"domain": "i.imgur.com",
"media_embed": {},
"levenshtein": null,
@tkh44
tkh44 / field.js
Created January 15, 2012 03:05
field validation
var validate = {
/**
* Username value check: must contain a lower and upper case letter and at least 1 number. Cannot contain special characters.
* @param field {NodeObject} the field object
* @return {boolean} the result of validation
*/
username: function(field){
//Regex statements are broken into parts for ease of maintenance.
var reUsernameUpperCase = /[A-Z]/,
reUsernameLowerCase = /[a-z]/,
@tkh44
tkh44 / test.js
Created January 17, 2012 19:59
TEST
YUI().use("jsonp", "substitute", "event", "panel", "tabview", function (Y){
//Form Validation
var validate = {
/**
* Username value check: must contain a lower and upper case letter and at least 1 number. Cannot contain special characters.
* @param field {NodeObject} the field object
* @return {boolean} the result of validation
*/
username: function(field){
//Regex statements are broken into parts for ease of maintenance.