Skip to content

Instantly share code, notes, and snippets.

View ninetwentyfour's full-sized avatar

Travis Berry ninetwentyfour

View GitHub Profile
@ninetwentyfour
ninetwentyfour / example1.html
Created August 28, 2011 22:27
Write Text Anywhere With HTML5 Canvas 1 - blogpost
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div id="main">
<canvas id="c"></canvas><!-- the canvas -->
</div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
</body>
@ninetwentyfour
ninetwentyfour / example10.php
Created August 28, 2011 22:02
Fast CakePHP Search With IndexTank 2 - blogpost
<?php $query = $this->data['Project']['search']; ?>
@ninetwentyfour
ninetwentyfour / example1.php
Created August 28, 2011 22:00
Fast CakePHP Search With IndexTank 1 - blogpost
<?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 / example10.php
Created August 28, 2011 21:07
Haml, Sass, Markdown, and CakePHP - Oh My! 2 - blogpost
ob_end_flush();
@ninetwentyfour
ninetwentyfour / example1.php
Created August 28, 2011 21:03
Haml, Sass, Markdown, and CakePHP - Oh My! 1 - blogpost
var $view = 'Haml';
@ninetwentyfour
ninetwentyfour / example1.txt
Created August 28, 2011 20:39
Clean URL’s in Nginx - blogpost
## Parse all .php file in the /var/www directory
location ~ \.php$
location ~ \.php$ {
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 / example10.txt
Created August 28, 2011 19:33
Lightning Fast PHP Server With Nginx, eAccelerator, and Varnish 2 - blogpost
sudo /etc/init.d/php5-fpm restart
@ninetwentyfour
ninetwentyfour / example1.txt
Created August 28, 2011 19:31
Lightning Fast PHP Server With Nginx, eAccelerator, and Varnish 1 - blogpost
sudo apt-get install nginx
@ninetwentyfour
ninetwentyfour / example1.php
Created August 28, 2011 19:20
Remove WordPress’ NoFollow Without A Plugin - blogpost
<?php
function comment_author_link_mine( $comment_ID = 0 ) {
echo get_comment_author_link_mine( $comment_ID );
}
function get_comment_author_link_mine( $comment_ID = 0 ) {
/** @todo Only call these functions when they are needed. Include in if... else blocks */
$url = get_comment_author_url( $comment_ID );
$author = get_comment_author( $comment_ID );
@ninetwentyfour
ninetwentyfour / example1.php
Created August 28, 2011 19:14
If is_page() With Regular PHP - blogpost
<?php
$baseurl = 'http://www.example.com'; //set the base url of the site
$pageYouWant = $baseurl."/the-rest-of-the-url"; //add the rest of the url you want to check against
$currentPage = $baseurl.$_SERVER['REQUEST_URI'];// this gets the current page url
if($pageYouWant==$currentPage) {
//do something
}
?>