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
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];
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() {
//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;
@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
$ ->
App.start()
App =
start: ->
console.log('test')
window.App = App
@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();
@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 / collider
Created July 3, 2012 01:38
Breaks apart things
var collider = function(string) {
var arr = [],
parts = string.split('[');
for (index in parts) {
arr.push(parts[index].replace(']', ''))
}
return arr;
@themusicman
themusicman / Gemfile
Created July 3, 2012 13:44
Checks a site for links that lead to 404 pages
source "http://rubygems.org"
gem 'anemone'
@themusicman
themusicman / include-experiments.rb
Created July 5, 2012 23:35
Experiments with Module Includes in Ruby
# I created a generic Rails like ApplicationController so that you can just
# run this code via a command line prompt without the need for Rails
module Recorder
def self.included(base)
base.send(:before_filter, :some_method)
base.send(:after_filter, :another_method)
end