Skip to content

Instantly share code, notes, and snippets.

@codersatx
codersatx / MY_Model.php
Created May 20, 2011 02:01
My base model class for my CodeIgniter-based cms.
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* My Model
*
* Used as a base class for all admin or app related model functions.
*
* @author Alex Garcia
* @since 0.1
* @version 1
*/
@codersatx
codersatx / Admin_Controller.php
Created May 20, 2011 02:16
My base admin controller for my custom cms.
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Admin Controller
*
* Provides methods and properties for all admin related objects.
*
*/
class Admin_Controller extends CI_Controller{
@codersatx
codersatx / sample.js
Created May 20, 2011 02:30
Some arbritrary jquery.
$(document).ready(function(){
$('.btn-delete-workflow-comment').click(function(e){
e.preventDefault();
var url = $(this).parent().attr('href') + '/do';
$(this).parent().parent().parent().fadeOut('slow');
ajax_request(url);
});
$('.btn-delete-image').click(function(e){
@codersatx
codersatx / index.php
Created May 20, 2011 03:09
The front controller for my portfolio that handles the loading of views based on the uri.
<?php
/*--------------------------------------------------------
Configurables
--------------------------------------------------------*/
$site_title = "San Antonio Web Designer and Developer - Alex Garcia";
$site_description = "The online web design and development portfolio of Alex Garcia.
A San Antonio based artist, web designer and web developer.";
$tracking_enabled = "false";
$site_offline = FALSE;
@codersatx
codersatx / paintings_full.js
Created May 20, 2011 04:04
The code for the paintings tab in the Garcia Mobile fine art iPhone app.
var win = Titanium.UI.currentWindow;
//Used when zooming into images.
var animation = Titanium.UI.createAnimation();
animation.duration = 500;
var infoText = Titanium.UI.createLabel({
text:win.fullDescription,
color:'#fff',
font:{fontSize:15, fontWeight:'normal'},
@codersatx
codersatx / ui.js
Created May 20, 2011 13:08
Arbritrary jQuery code which handles some ui items.
jQuery(document).ready(function(){
//-----------------------------------------------------------------------------
//Temporary code to set the classes on the body tag based on the current segments.
//This will be used to style specific pages or sections or to qualify an already defined general class on that page.
//Get the segments in the url after the host name
var pathArray = window.location.pathname.split( '/' );
@codersatx
codersatx / Table.php
Created May 20, 2011 13:14
Table class used in Kohana to build tables programmatically.
<?php defined('SYSPATH') OR die('No direct access allowed.');
/**
* Table
*
* Handles the creation of tables programmatically
*/
class Table{
public $table_open;
public $table_rows;
@codersatx
codersatx / Dropdown.php
Created May 20, 2011 13:15
Dropdown class used in Kohana to create dropdowns programatically.
<?php
/**
* Drop Down
*
* Enables easier creation of drop downs within our code.
*/
class Dropdown{
public $dd_open;
public $dd_options;
@codersatx
codersatx / Project.php
Created May 20, 2011 13:17
The project controller class for a Kohana based cms.
<?php defined('SYSPATH') OR die('No direct access allowed.');
/**
* Project Controller
*
* Handles the data traffic for our projects.
*
* @package Project_Controller
* @category Controllers
* @author Alex Garcia
* @copyright Copyright (c) 2010, KGBTexas
@codersatx
codersatx / date-picker.js
Created June 11, 2011 02:06
Some code to manipulate the jQuery UI calendar.
$(document).ready(function(){
var today = new Date();
today = new Date(today.getFullYear(), today.getMonth(), today.getDate()); // Zero time components
var tomorrow = today.getDay() + 1;
var next_two_days = today.getDay() + 2;
var next_three_days = today.getDay() + 3;
var curr_time = getTime();
var curr_day = today.getDate();