Skip to content

Instantly share code, notes, and snippets.

View keithmorris's full-sized avatar

Keith Morris keithmorris

  • Athens, Georgia USA
View GitHub Profile
@keithmorris
keithmorris / TwitterHighlights.snippet.php
Created June 24, 2012 00:35 — forked from philsturgeon/TwitterHighlights.snippet.php
MODX Revolution Output filter to create links from Twitter @name, #tag and URLs
<?php
/**
* TwitterHighlights
* Output filter to create links from Twitter @name, #tag and URLs
*/
$input = preg_replace("#(^|[\n ])([\w]+?://[\w]+[^ \"\n\r\t< ]*)#", "\\1<a href=\"\\2\" rel=\"nofollow\">\\2</a>", $input);
$input = preg_replace("#(^|[\n ])((www|ftp)\.[^ \"\t\n\r< ]*)#", "\\1<a href=\"http://\\2\" rel=\"nofollow\">\\2</a>", $input);
$input = preg_replace("/@(\w+)/", "<a href=\"https://www.twitter.com/\\1\" rel=\"nofollow\">@\\1</a>", $input);
$input = preg_replace("/#(\w+)/", "<a href=\"https://www.twitter.com/search/\\1\" rel=\"nofollow\">#\\1</a>", $input);
@keithmorris
keithmorris / gist:3159847
Created July 22, 2012 14:23
WordPress (.htaccess) - Single
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
@keithmorris
keithmorris / .htaccess
Created July 22, 2012 14:24 — forked from gregrickaby/.htaccess
Default WordPress.htaccess
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
@keithmorris
keithmorris / csv-to-json.php
Created September 11, 2012 23:56 — forked from robflaherty/csv-to-json.php
Convert CSV to JSON
<?php
/*
* Converts CSV to JSON
* Example uses Google Spreadsheet CSV feed
* csvToArray function I think I found on php.net
*/
header('Content-type: application/json');
// Set your CSV feed
@keithmorris
keithmorris / script.js
Created October 2, 2012 01:58 — forked from mjfathinia/simple-js-inheritance.js
Simple JavaScript Inheritance By John Resig
var Person = Class.extend({
init: function(isDancing){
this.dancing = isDancing;
},
dance: function(){
return this.dancing;
}
});
var Ninja = Person.extend({
init: function(){
@keithmorris
keithmorris / Wordpress ROBOTS.TXT file
Created November 10, 2012 18:10 — forked from chuckreynolds/robots.txt
Hardened robots.txt for wordpress installs
# Robots Rule! - Sometimes... #
User-agent: *
Allow: /
# Disallow these directories, url types & file-types
Disallow: /cgi-bin
Disallow: /wp-admin/
Disallow: /wp-includes/
Disallow: /wp-content/
Disallow: /search/*/feed
@keithmorris
keithmorris / readme
Created December 4, 2012 21:57 — forked from ScottPhillips/readme
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.
@keithmorris
keithmorris / boilerplate-widget.php
Created December 4, 2012 23:51 — forked from eddiemoya/boilerplate-widget.php
WordPress Boilerplate Widget
<?php /*
Plugin Name: Boilerplate Widget
Description: Starting point for building widgets quickly and easier
Version: 1.0
Author: Eddie Moya
/**
* IMPORTANT: Change the class name for each widget
*/
class Boilerplate_Widget extends WP_Widget {
<?php
require_once 'ControllerTestCase.php';
class AccountControllerTest extends ControllerTestCase
{
public function testSignupWithNoDataRedirectsAndHasErrors()
{
$response = $this->post('account@signup', array());
@keithmorris
keithmorris / nginx-s3.conf
Created October 17, 2017 16:18 — forked from surjikal/nginx-s3.conf
Nginx - Wildcard subdomains, basic auth and proxying to s3. Set a policy to only allow your server's IP.
server {
listen 80;
server_name *.foo.example.com;
# We need this to resolve the host, because it's a wildcard.
# This is google's DNS server.
resolver 8.8.8.8;
include /etc/nginx/includes/proxy.conf;