Skip to content

Instantly share code, notes, and snippets.

View jcinis's full-sized avatar
BECOMING A SPHERE

Jessey White-Cinis jcinis

BECOMING A SPHERE
View GitHub Profile
@jcinis
jcinis / jquery.append.js
Created March 15, 2013 16:00
jQuery plugin to add event triggering to dom elements anytime they append or are appended. The reason for creating this is was to allow backbone.js views to be aware of their being added to the dom and to trigger post-render functionality.
/**
* Adds event triggering whenever an append takes place.
*
* - Parent is given an "append" trigger with the child as an arguement
* - Child is given an "appended" trigger with the parent as an argument
*
* @author Jessey White-Cinis <jcinis@gmail.com>
*/
(function($) {
var jqueryAppend = $.fn.append;
@jcinis
jcinis / EmailSignup.php
Last active December 14, 2015 15:59
Quick and dirty email signup in php and sqlite
<?php
class EmailSignup {
private $db;
// defaults can be overwritten on instantiation
private $filename = "emailsignups.sqlite";
private $tablename = "emails";
@jcinis
jcinis / gist:2866253
Created June 4, 2012 04:02
Generate a random username for Django
from random import choice
from string import ascii_lowercase, digits
from django.contrib.auth.models import User
def generate_random_username(length=16, chars=ascii_lowercase+digits, split=4, delimiter='-'):
username = ''.join([choice(chars) for i in xrange(length)])
if split:
username = delimiter.join([username[start:start+split] for start in range(0, len(username), split)])