Skip to content

Instantly share code, notes, and snippets.

View themusicman's full-sized avatar
🏠
Working from home

Thomas Brewer themusicman

🏠
Working from home
View GitHub Profile
@themusicman
themusicman / jquery-proxy-love
Created March 27, 2012 14:20
A little jQuery proxy love
var templateRetrieved = this.getTemplate();
jQuery.when(templateRetrieved).then(jQuery.proxy(function(template){
var html = this.renderTemplate(template, data);
this.$el.html(html);
}, this));
@themusicman
themusicman / Toolbox_Template_Form
Created March 14, 2012 14:38
EE2 Template Form Class
<?php
class Toolbox_Template_Form {
protected $form_html = NULL;
protected $tagdata = '';
protected $options = array();
$ ->
App.start()
App =
start: ->
console.log('test')
window.App = App
@themusicman
themusicman / EE2 Usage of Secondary Database Connection
Created August 1, 2011 16:47
EE2 Usage of Secondary Database Connection
$this->EE = get_instance();
//get entries form main EE db
$entries = $this->EE->db->from('channel_titles')->get();
/*
Things to note:
1. We are using the secondary index we specified in the database.php file
2. And we are passing TRUE as the second parameter
3. Lastly we are assigning the new database connection to the variable $secondary_db
//standard databases connection information
$db['expressionengine']['hostname'] = "localhost";
$db['expressionengine']['username'] = "db_username";
$db['expressionengine']['password'] = "db_password";
$db['expressionengine']['database'] = "db_name";
$db['expressionengine']['dbdriver'] = "mysql";
$db['expressionengine']['dbprefix'] = "exp_";
$db['expressionengine']['pconnect'] = FALSE;
$db['expressionengine']['swap_pre'] = "exp_";
$db['expressionengine']['db_debug'] = TRUE;
var SITE = {
URL: 'http://google.com',
init: function() {
//bring "this" (SITE object) into scope for the anonymous function passed to the click method.
var self = this;
$('#link').click(function() {
leftSideBounds = [leftSideOfSplitView bounds];
tableScrollView = [[CPScrollView alloc] initWithFrame:CGRectMake(0, 0, leftSideBounds.size.width, leftSideBounds.size.height)];
[tableScrollView setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable];
[tableScrollView setAutohidesScrollers:YES];
[leftSideOfSplitView addSubview:tableScrollView];
scrollBounds = [tableScrollView bounds];
tableView = [[CPTableView alloc] initWithFrame:CGRectMake(0, 0, scrollBounds.size.width, scrollBounds.size.height)];
[tableView setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable];