Skip to content

Instantly share code, notes, and snippets.

View tjboudreaux's full-sized avatar
🎯
Focusing

Travis Boudreaux tjboudreaux

🎯
Focusing
View GitHub Profile
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
@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.
@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 / 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 / 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 / gist:807206
Created February 2, 2011 03:42
Apply a Background Image to UINavigationBar.
@implementation UINavigationBar (CustomImage)
- (void)drawRect:(CGRect)rect {
UIImage *image = [UIImage imageNamed: @"NavigationBar.png"];
[image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
}
@end
@tjboudreaux
tjboudreaux / FitFactor
Created March 16, 2011 04:03
QTObject Code that causes a jQuery error
<div class="register-videos"><span class="vvqbox vvqquicktime" style="width:595px;height:300px;"><script type="text/javascript">var myQTObject = new QTObject("http://fitfactor.hemophiliafed.org/wp-content/uploads/videos/FitFactor2011-survey-intro/FitFactor2011-survey-intro.mov", "vvq-26-quicktime-1", "595", "300"); myQTObject.addParam("autoplay", "false"); myQTObject.addParam("controller", "true"); myQTObject.addParam("scale", "aspect"); myQTObject.write();</script><embed type="video/quicktime" src="http://fitfactor.hemophiliafed.org/wp-content/uploads/videos/FitFactor2011-survey-intro/FitFactor2011-survey-intro.mov" width="595" height="300" id="vvq-26-quicktime-1" autoplay="false" controller="true" scale="aspect"></span></div>
<script type="text/javascript">
//you can wrap this in a click function or some other event.
$("#content_to_hide").hide();
</script>
<!-- content you don't want to hide in css of the wrapper,
set height,width,& bg on this element -->
<div id="content_wrapper">
<!-- content you want to hide -->
@tjboudreaux
tjboudreaux / gist:1045629
Created June 24, 2011 20:35
Kubed Sitemaps
# Rewrite sitemap.xml to the appropriate action
RewriteRule ^sitemap.xml$ /mod_site/public/google-sitemap
# Send all other requests to the Zend Framework dispatch script
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* /index.php
@tjboudreaux
tjboudreaux / gist:1122944
Created August 3, 2011 15:43
Virtual Document Roots For Development Environment
<VirtualHost *:80>
UseCanonicalName off
ServerAlias branch.*.local
VirtualDocumentRoot /Users/tjboudreaux/Sites/%3.0.%4.0/branches/%2.0
<Directory />
Order allow,deny
Allow from all
AllowOverride All
</Directory>
</VirtualHost>