Skip to content

Instantly share code, notes, and snippets.

View ScottPhillips's full-sized avatar

Scott Phillips ScottPhillips

  • Los Angeles, CA
View GitHub Profile
@ScottPhillips
ScottPhillips / gist:2382192
Created April 14, 2012 04:56 — forked from luetkemj/wp-query-ref.php
WP: Query $args
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query
* Source: http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/query.php
*/
$args = array(
@ScottPhillips
ScottPhillips / readme
Created April 6, 2012 18:34
Boilerplate Wordpress Custom Post Type
<?php
/*
Setup and add our custom post types
*/
function create_post_types(){
@ScottPhillips
ScottPhillips / readme
Created April 6, 2012 18:32
Boilerplate Wordpress Widget
How to Use
Step 1.
Copy the custom_widget.php file and place it in your WordPress theme folder. Assuming WordPress is installed in the root of your server the file will be place in /wp-content/themes/yourtheme/
Step 2.
Open up functions.php and include the following piece of code somewhere in the file. include TEMPLATEPATH . '/custom_widget.php';
Step 3.
Edit the custom_widget.php file to suit your needs.
@ScottPhillips
ScottPhillips / example.php
Created March 10, 2012 23:11 — forked from drewjoh/example.php
A Simple Postmark PHP Class with Attachments
<?php
require("postmark.php");
$postmark = new Postmark("your-api-key","from-email","optional-reply-to-address");
$result = $postmark->to("reciver@example.com")
->subject("Email Subject")
->plain_message("This is a plain text message.")
->attachment('File.pdf', $file_as_string, 'application/pdf')
@ScottPhillips
ScottPhillips / .htaccess
Created February 2, 2012 07:03
My Default .htaccess File for Running on RackSpace Cloud Sites
########################################
# Adjust Memory/Post/Execution/ Upload Size
########################################
php_value max_execution_time 3600
php_value upload_max_filesize 100M
php_value post_max_size 220M
php_value memory_limit 256M
########################################
# Display Errors: (Comment out for no Errors)
@ScottPhillips
ScottPhillips / .htaccess
Created February 2, 2012 04:30
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@ScottPhillips
ScottPhillips / Terminal_Commands
Created January 20, 2012 22:23
Install Lua on your Mac OSX
# Download and install xCode to install make.
# http://itunes.apple.com/us/app/xcode/id448457090?mt=12
# Don't forget to run "/Applications/Install Xcode.app"
# Open up your terminal, and follow the steps below
# by cutting pasting or typing the below in.
# The number sign indicates a comment.
# Make a temporary directory
mkdir temp
@ScottPhillips
ScottPhillips / facebook_fql_queries.php
Created January 4, 2012 18:11
Using the PHP SDK to run FQL queries using the Facebook Graph API
<?php
$facebook = new Facebook(array(
'appId' => 'YOUR_API_KEY',
'secret' => 'YOUR_API_SECRET',
'cookie' => true,
));
$fql = "SELECT page_id, name from page where name='Coke'";
@ScottPhillips
ScottPhillips / fan_count.php
Created January 4, 2012 07:12
Faceboook SDK PHP : Get Number of Fans
<?php
require('facebook.php');
$facebook = new Facebook(array(
'appId' => 'YOUR_APP_ID',
'secret' => 'YOUR_APP_SECRET',
));
$cokeFans = $facebook->api('/cocacola');
@ScottPhillips
ScottPhillips / header_using_apache.php
Created January 3, 2012 07:08
Get the headers of incoming requests using PHP
<?php
$headers = apache_request_headers();
foreach ($headers as $header => $value) {
echo "$header: $value <br />\n";
}
?>