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 / .htaccess
Created June 30, 2012 12:09
CodeIgniter .htaccess file
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
@keithmorris
keithmorris / drive-format-ubuntu.md
Last active May 7, 2026 02:01
Partition, format, and mount a drive on Ubuntu
@keithmorris
keithmorris / gini
Created June 19, 2014 21:14
Simple shell script to initialize a Git repository, create an initial commit, add origin server, create a develop branch and push to the server
#!/usr/bin/env bash
git init .
touch .gitignore
git add --all
git commit -m"initial commit"
git remote add origin $1
git branch develop
git push origin --all
@keithmorris
keithmorris / remove-words.php
Created November 27, 2012 16:22
PHP remove common words from a string
<?php
function removeCommonWords($input){
// EEEEEEK Stop words
$commonWords = array('a','able','about','above','abroad','according','accordingly','across','actually','adj','after','afterwards','again','against','ago','ahead','ain\'t','all','allow','allows','almost','alone','along','alongside','already','also','although','always','am','amid','amidst','among','amongst','an','and','another','any','anybody','anyhow','anyone','anything','anyway','anyways','anywhere','apart','appear','appreciate','appropriate','are','aren\'t','around','as','a\'s','aside','ask','asking','associated','at','available','away','awfully','b','back','backward','backwards','be','became','because','become','becomes','becoming','been','before','beforehand','begin','behind','being','believe','below','beside','besides','best','better','between','beyond','both','brief','but','by','c','came','can','cannot','cant','can\'t','caption','cause','causes','certain','certainly','changes','clearly','c\'mon','co','co.','com','come','comes','concerni
@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 / MD-Sandbox.md
Last active September 11, 2019 11:31
Markdown Sandbox

Environment Aware Wordpress wp-config File

Summary

This is a customized Wordpress wp-config.php that allows loading of custom config files for specific environments. The supplemental config files follow the naming convention of wp-config-{environment}.php.

The purpose of this approach is to eliminate code changes when moving between environments (local, dev, stage, production, etc). The environments are fully customizable and based on programatically inspecting the $_SERVER['SERVER_NAME'] superglobal.

Usage

@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 / keybase.md
Created January 1, 2018 14:18
keybase.md

Keybase proof

I hereby claim:

  • I am keithmorris on github.
  • I am keithmorris (https://keybase.io/keithmorris) on keybase.
  • I have a public key ASDSFHRtkRNgkJAOWcOCZFH09qOvlczUMwZQA5xOSTNhswo

To claim this, I am signing this object:

@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;
@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