Skip to content

Instantly share code, notes, and snippets.

@tkh44
tkh44 / models.py
Created September 19, 2012 18:02
CRS models
from django.db import models
from django.contrib.localflavor.us.models import PhoneNumberField, USStateField
#Sorl-Thumbnail
from sorl.thumbnail import ImageField
import re
"""
Benefit Definitions
"""
@tkh44
tkh44 / requirements.txt
Created September 19, 2012 18:25
requirements.txt
Django==1.3
gondor==1.0b1.post14
psycopg2==2.4.1
-e git+git://github.com/tkh44/django-guardian.git#egg=django-guardian
-e git+git://github.com/sorl/sorl-thumbnail.git#egg=sorl-thumbnail
south
django-tinymce
django-reversion
django-grappelli==2.3.4
PIL
@tkh44
tkh44 / index.html
Created October 8, 2012 18:26
Trying to get a working model of a pie chart type model of a statistic.
<div class="pieContainer">
<div class="pieBackground">
</div>
<div id="pieSlice1" class="hold">
<div class="pie">
</div>
</div>
<div class="stat-circle-cover">
<span class="stat-number">
25%
@tkh44
tkh44 / main.js
Created November 29, 2012 15:42
color main
(function(window, $) {
var elements = {};
window.Spectrum = (function(elements){
var initialize = function() {
elements.$colorField = $('#colorField');
elements.$generateColorForm = $('#generateColorForm');
elements.$frontPage = $('#frontPage');
elements.$generateContainer = $('#generateContainer');
function randomString(length) {
var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz'.split('');
if (! length) {
length = Math.floor(Math.random() * chars.length);
}
var str = '';
for (var i = 0; i < length; i++) {
str += chars[Math.floor(Math.random() * chars.length)];
@tkh44
tkh44 / data-bind.js
Created January 9, 2013 19:00
Automatically bind events from data-attribute. This is based off of sparky.js, but ported to YUI3.
/*Automatic binding handler
*Attribute data-handler is the function in Events.handlers that handles the event
*Attribute data-event is the event to bind to element. Defaults to click if none is provided
* -To attach multiple events seperate them with '|'. Ex. data-event="click|focus"
*Attribute data-binded can be set to false to prevent the event from being attached to the element at run time.
* -Set attribute to true then run Events.bindEvents() to bind the event. Elements that have already been bound are skipped.
*/
Events = {
handlers: {
@tkh44
tkh44 / filter.js
Last active December 11, 2015 03:59
Category/Item Filter using Autocomplete components from YUI3
YUI().add('filter-search-plugin', function (Y) {
var FilterSearch = Y.Base.create('filterSearch', Y.Base, [Y.AutoCompleteBase], {
initializer: function() {
this._bindUIACBase();
this._syncUIACBase();
}
});
FilterPlugin = Y.Base.create('filterPlugin', Y.Plugin.Base, [], {
initializer: function() {
/**
* BUTTONS
*/
.button,
button,
input[type="button"],
input[type="submit"] {
min-width: 110px;
display: inline-block;
padding: 4px;
@tkh44
tkh44 / test.html
Created January 31, 2013 21:13
button-group
<div class="button-group">
<button class="button secondary">Generate Password</button>
<button class="button secondary dropdown-toggle" data-toggle="dropdown">
<span class="gear">&#x2699;</span>
</button>
<ul class="dropdown-menu pull-right">
<li>
<div class="dropdown-form-item">
<div id="passwordSlider" class="dropdown-form-item">
<span>Password Length: <span></span></span>
@tkh44
tkh44 / rollbox.js
Last active December 12, 2015 05:59
if ( boxId in elements.collapsedBoxes ) {
// TODO: This should be changed to yui3 fade,slide???
//Show
var showAnim = new Y.Anim({
node: bodyNode,
to: {
height: function(node) {
return node.getData('old-height');
},
paddingTop: '9px',