Skip to content

Instantly share code, notes, and snippets.

View ninetwentyfour's full-sized avatar

Travis Berry ninetwentyfour

View GitHub Profile
@ninetwentyfour
ninetwentyfour / CakePHP_IndexTank.php
Created May 24, 2011 01:03
Functions to interact with IndexTank
<?php
function createIndextankClient(){
App::import('Vendor', 'indextank_client');
$API_URL = 'YOUR API URL HERE';
$client = new ApiClient($API_URL);
return $client;
}
function addIndextank($indexType,$id,$data){
//send project to indextank
@ninetwentyfour
ninetwentyfour / NginxConfig
Created May 24, 2011 01:08
Clean URL’s in Nginx
## Parse all .php file in the /var/www directory
location ~ \.php$
location ~ $ {
##fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www$fastcgi_script_name;
include fastcgi_params;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
@ninetwentyfour
ninetwentyfour / gist:990112
Created May 25, 2011 01:01
Zip Folder PHP
<?php
//Get the directory to zip
$filename_no_ext= $_GET['directtozip'];
// we deliver a zip file
header("Content-Type: archive/zip");
// filename for the browser to save the zip file
header("Content-Disposition: attachment; filename=$filename_no_ext".".zip");
@ninetwentyfour
ninetwentyfour / gist_helper.rb
Created May 30, 2011 02:42
Will create a gist and return the embed code with ruby
require 'net/http'
require 'uri'
require 'json'
def get_gist(fileName,content)
res = Net::HTTP.post_form(URI.parse('http://gist.github.com/api/v1/json/new'),
{ 'files[#{fileName}]' => content,
'login' => 'USER NAME HERE',
'token' => 'API TOKEN HERE',
'description' => 'This is a test description'
@ninetwentyfour
ninetwentyfour / gravatar_helper.rb
Created May 30, 2011 02:45
Rails Helper that will return a url for a gravatar
module GravatarHelper
def gravatar_url_for(email, options = {})
options = { :size => '200', :default => 'retro', :rating => 'pg'}.merge(options)
size = options[:size]
rating = options[:rating]
default = options[:default]
# create the md5 hash
hash = Digest::MD5.hexdigest(email)
@ninetwentyfour
ninetwentyfour / highlightedNav.php
Created August 28, 2011 15:55
Creating Navigation Highlights - blogpost
<ul>
<li<?php if ( is_page('about') || is_404() ){ echo ' class="current_page_item" ';}?>><a href="<?php echo get_option('home'); ?>/">Home</a></li>
<li<?php if ( is_home() || is_page('blog')|| is_single() || is_search() || is_archive()) { echo ' class="current_page_item"'; } ?>><a href="<?php bloginfo('url'); ?>/blog/">Blog</a></li>
<li<?php if ( is_page('work') || is_page('video') || is_page('web')) { echo ' class="current_page_item"'; } ?>><a href="<?php bloginfo('url'); ?>/work/">Work</a></li>
<li<?php if ( is_page('contact')) { echo ' class="current_page_item"'; } ?>><a href="<?php bloginfo('url'); ?>/contact/">Contact</a></li>
</ul>
@ninetwentyfour
ninetwentyfour / quicktime.html
Created August 28, 2011 16:00
Quicktime embed - blogpost
<OBJECT CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" WIDTH="320" HEIGHT="240" CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab">
<PARAM name="SRC" VALUE="poster.mov">
<PARAM name="QTSRC" VALUE="rtsp://your_streaming_subdomain.com:554/your_streaming_subdomain.com/movie.mov">
<PARAM name="AUTOPLAY" VALUE="true">
<PARAM name="CONTROLLER" VALUE="false">
<embed src="poster.mov" qtsrc="rtsp://your_streaming_subdomain.com:554/your_streaming_subdomain.com/movie.mov" width="320" height="240" target="myself" controller="false" autoplay="true"></embed>
</OBJECT>
@ninetwentyfour
ninetwentyfour / command1.txt
Created August 28, 2011 16:20
git dreamhost - blogpost
mkdir gittest
cd gittest
git --bare init
@ninetwentyfour
ninetwentyfour / example1.css
Created August 28, 2011 16:23
Making display:none; Javascript Accessible - blogpost
.menu_body{ display:none; }
@ninetwentyfour
ninetwentyfour / example1.txt
Created August 28, 2011 16:33
Improve YSlow Score With .htaccess - blogpost
Header unset ETag
FileETag None
<FilesMatch "\.(css|js)$">
SetOutputFilter DEFLATE
</FilesMatch>
<FilesMatch "\.(mov|otf|eot|ttf|ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
Header set Expires "Thu, 15 Apr 2010 20:00:00 GMT"