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 / remove_closing_tags.sh
Created January 9, 2018 15:55 — forked from lorenzo/remove_closing_tags.sh
Script to remove all closing ?> php tags in a folder
#!/bin/bash
# vim:ft=sh:ts=3:sts=3:sw=3:et:
###
# Strips the closing php tag `?>` and any following blank lines from the
# end of any PHP file in the current working directory and sub-directories. Files
# with non-whitespace characters following the closing tag will not be affected.
#
# Author: Bryan C. Geraghty <bryan@ravensight.org>
# Date: 2009-10-28
@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;
<?php
require_once 'ControllerTestCase.php';
class AccountControllerTest extends ControllerTestCase
{
public function testSignupWithNoDataRedirectsAndHasErrors()
{
$response = $this->post('account@signup', array());
@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 {
@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 / 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 / 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 / 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 / .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 / 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>