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 / build.xml
Created November 21, 2011 14:47
Snippet: Blackberry Webworks App Build Ant File
<?xml version="1.0" encoding="utf-8" ?>
<!--
Name should have no spaces and be only alpha characters.
The project name will be used to generate your .zip archive and .bar file
-->
<project name="Webworks App" default="builddeploy" basedir=".">
<description>
Build file for a Blackberry Webworks API App
</description>
@tjboudreaux
tjboudreaux / phing-upgrade-wordpress
Created November 14, 2011 15:47 — forked from lovett/phing-upgrade-wordpress
Snippet: Phing: Upgrade Wordpress
<target name="wordpress.upgrade">
<property name="tmp" value="/tmp" />
<property name="src" value="${tmp}/wordpress" />
<delete dir="${src}" includeemptydirs="true" failonerror="true" />
<exec dir="${tmp}" command="curl -s http://wordpress.org/latest.tar.gz | tar -xz" />
<delete dir="wp-admin" includeemptydirs="true" failonerror="true" />
<delete dir="wp-includes" includeemptydirs="true" failonerror="true" />
<move file="wp-config.php" tofile="wp-config.php.bak" overwrite="true"/>
@tjboudreaux
tjboudreaux / Question2.php
Created November 9, 2011 14:59
Programming Question: PHP: Largest Repeated Subset
<?php
/**
* 2) Unique characters. Determine if a string contains all unique characters without using an additional data structure or php
* functions (ie array_unique). For example, “sfg25oax” returns true, but “asg0msr” returns false.
*
* I would have preferred to use an array that would have stored a boolean flag at the index of the ASCII value of each
* character, as that would have been a much more efficient algorithm O(n) as opposed to possibly O(n*n), but that seems to violate
* the requirement of not using data structures.
*
* There is a simple test function that will test for the two cases provided, along with testing for the exceptions.
@tjboudreaux
tjboudreaux / animate.js
Created August 19, 2011 19:00
Javascript to animate menu
$(document).ready(function(){
$('#header #main_menu li').hover(function(){
$(this).find("a .button").animate({top:'30px'},"50", function(){
$(this).parent().parent().find(".submenu").show().animate({right:'110px'},{queue:false,duration:100});
});
}, function(){
$(this).find(".submenu").animate({right:'0px'},"50", function(){
$(this).hide();
$(this).parent().find("a .button").animate({top:'0px'},"50");
@tjboudreaux
tjboudreaux / virtual.prepend.php
Created August 19, 2011 16:35
Fixes broken $_SERVER['DOCUMENT_ROOT'] with Apache VirtualDocumentRoot
/**
* URL Patterns to look for
* This function is used to fix the document root for sites that are using
* one of my VirtualDocumentRoot site entries
* This is to fix a bug in Apache's mod_vhost_alias not setting up the correct
* $_SERVER['DOCUMENT_ROOT'] env variable.
*
* trunk.{directory}.local - maps to /Users/tjboudreaux/Sites/{directory}/trunk
* branch.{branch-name}.{directory}.local - maps to /Users/tjboudreaux/Sites/{directory}/branches/{branch-name}
*
@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>
@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
<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 / 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>
@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