Skip to content

Instantly share code, notes, and snippets.

View tjboudreaux's full-sized avatar
🎯
Focusing

Travis Boudreaux tjboudreaux

🎯
Focusing
View GitHub Profile
@tjboudreaux
tjboudreaux / gist:807202
Created February 2, 2011 03:38
Custom UITabBar Background
@implementation UITabBar (CustomImage)
- (void)drawRect:(CGRect)rect{
[super drawRect:rect];
UIImage *image = [UIImage imageNamed:@"TabBar.png"];
[image drawInRect:rect];
}
@end
@tjboudreaux
tjboudreaux / UINavigationBar+dropshadow.m
Created November 17, 2010 07:11
Applying a drop shadow to a UINavigationBar with a category.
@interface UINavigationBar (dropshadow)
-(void) applyDefaultStyle;
@end
@implementation UINavigationBar (dropshadow)
-(void)willMoveToWindow:(UIWindow *)newWindow{
[super willMoveToWindow:newWindow];
@tjboudreaux
tjboudreaux / Javascript redirect example
Created November 4, 2010 04:18
uncomment window.location to make it redirect.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>Page Title</title>
<script type="text/javascript" charset="utf-8" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
@tjboudreaux
tjboudreaux / gist:652963
Created October 29, 2010 05:11
Getting the Average Value of a column in Core Data.
NSManagedObjectContext *managedObjectContext = [(AppDelegate_Shared*)[UIApplication sharedApplication].delegate managedObjectContext];
NSFetchRequest *request = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription entityForName:@"Log" inManagedObjectContext:managedObjectContext];
[request setEntity:entity];
// Specify that the request should return dictionaries.
[request setResultType:NSDictionaryResultType];
// Create an expression for the key path.
processor : 0
vendor_id : AuthenticAMD
cpu family : 15
model : 37
model name : AMD Opteron(tm) Processor 246
stepping : 1
cpu MHz : 2010.241
cache size : 1024 KB
fpu : yes
fpu_exception : yes
git clone git://github.com/ry/node.git
cd node
./configure
make
sudo make install
grep '2010-02-17' error.log
require 'rubygems'
require 'active_record'
require 'robots'
dbconfig = YAML::load(File.open("db.yml"))
ActiveRecord::Base.establish_connection(dbconfig)
ActiveRecord::Base.logger = Logger.new(STDERR)
class DomainName < ActiveRecord::Base
end
public function postUpdate($event)
{
$profile = Zend_Registry::getInstance()->get("role");
$currentRecord = $this->getTable()->find($event->getInvoker()->id);
$profile->steps = $profile->steps - $currentRecord->steps +
$event->getInvoker()->steps;
$profile->save();
}
public function findLeadersBySchool($schoolId = 1, $limit = 3)
{
return $this->findLeadersBaseQuery()
->leftJoin('u.Assignment_Assignee a ON u.id = a.assigned_entity_id ')
->addWhere('a.assigned_entity_type = ?', User_Model_Student::ENTITY_TYPE)
->addWhere('a.assignee_entity_type = ?', Plan_Model_Classroom::ENTITY_TYPE)
->addWhere('a.assignee_entity_id = ?', $schoolId)
//->limit($limit)
->execute();
}