Skip to content

Instantly share code, notes, and snippets.

@robrocker7
robrocker7 / functions.php
Created October 22, 2010 17:45
Changes added for guided tour
// Custom Testimonal scripts written by Robert
class Helper {
protected static $db_connection = false;
protected static $debug = true;
protected static function connect_to_database($args = array()) {
// Create a Database Connection
// accepts an option $args array for testing database connections
// if there is an error, then fail without breaking site
try {
@robrocker7
robrocker7 / header.php.js
Created October 22, 2010 18:12
Code that was being used is commented out, new code is below
/*
$('#home_testimonials a.wpaudio').bind('click', function() {^M
if ($(this).hasClass('clicked')) {^M
$(this).css('background-image', 'url(<?php bloginfo("template_directory"); ?>/images/icon_listen_home.png)');^M
$(this).removeClass('clicked');^M
} else {^M
$(this).css('background-image', 'url(<?php bloginfo("template_directory"); ?>/images/icon_pause.png)');^M
$(this).addClass('clicked');^M
}^M
});^M
@robrocker7
robrocker7 / header.php.js
Created October 22, 2010 21:57
Changes for wpaudio javascript
$('.wpaudio').click(function() {
current_image = $(this).css('background-image');
if('<?php the_title(); ?>' == 'Home') {
background_image = '/wp-content/themes/profitfuel/images/icon_listen_home.png';
} else {
background_image = '/wp-content/themes/profitfuel/images/icon_listen_testimonials.png';
}
$('.wpaudio').css('background-image', 'url('+background_image+')');
if(current_image.match(/icon_pause/)){
$(this).css('background-image', 'url('+background_image+')');
def assign_roles(self):
from apps.comm.models import Chatroom
import math
# walk through player size and set roles
query_users = self.userrole_set.order_by('?')
users = [u for u in query_users]
user_length = len(users)
# start with smallest group
roles = {}
def assign_roles(self, user_length=None):
from apps.comm.models import Chatroom
import math
import random
# walk through player size and set roles
query_users = self.userrole_set.order_by('?')
users = [u for u in query_users]
if user_length is None:
user_length = len(users)
if user_length >= 4:
roles['RANDOM_ONE'] = ['VILLAGER',
'WITCHDOCTOR',
'MARTYR',
'CURSED',
'PUTRID',
'VILLAGER']
if user_length > 4: # 5 players
required_roles = ['WEREWOLF',
'PSYCHIC',
import pycurl
import base64
import StringIO
import datetime
from xml.dom import minidom
from dateutil import relativedelta
from django.http import HttpResponse, HttpResponseRedirect
class GoogleResponse:
<?xml version="1.0" encoding="UTF-8" ?>
<checkout-shopping-cart xmlns="http://checkout.google.com/schema/2">
<shopping-cart>
<items>
<item>
<item-name>Subscription to My Awesome Site</item-name>
<item-description>Twelve Months of Access to My Awesome Site</item-description>
<unit-price currency="USD">0.00</unit-price>
<quantity>1</quantity>
<merchant-private-item-data>
doc = minidom.Document()
# cart object world
cart = doc.createElement('checkout-shopping-cart')
cart.setAttribute("xmlns","http://checkout.google.com/schema/2")
item_cart = doc.createElement('shopping-cart')
cart.appendChild(item_cart)
# merchant item data
merch_data = doc.createElement('merchant-private-data')
@charset "UTF-8";
/************************************
* Reset *
************************************/
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,tt,var,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-weight:inherit;font-style:inherit;font-size:100%;font-family:inherit;vertical-align:baseline;}:focus{outline:0;}body{line-height:1;color:#000;background: #fff;}ol,ul{list-style:none;}table{border-collapse:separate;border-spacing:0;}caption,th,td{text-align:left;font-weight:normal;}blockquote:before,blockquote:after,q:before,q:after{content:"";}blockquote,q{quotes:"" "";}.container_full{overflow:hidden;width:100%;}.padding_10{padding:10px;}.center{text-align:center;}.absolute{position:absolute!important;}.relative{position:relative!important;}.text-center{text-align:center;