Skip to content

Instantly share code, notes, and snippets.

Joseph Spurrier josephspurrier

Block or report user

Report or block josephspurrier

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@josephspurrier
josephspurrier / color.php
Last active Aug 29, 2015
CSS Style Selectors for Color
View color.php
<!DOCTYPE HTML>
<html>
<style>
* {
color: white;
}
p {
color: green;
}
@josephspurrier
josephspurrier / .htaccess
Last active Aug 29, 2015
Apache root configuration for Trailing Slash Solution - http://josephspurrier.com/trailing-slash-solution/
View .htaccess
# Remove Apache variations on URL, best for SEO
Options -MultiViews
<IfModule mod_dir.c>
# Ensure index.php is only allowed as index
DirectoryIndex index.php
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
@josephspurrier
josephspurrier / .htaccess
Last active Aug 29, 2015
Apache CheckSpelling for .htaccess
View .htaccess
<IfModule mod_speling.c>
CheckSpelling On
CheckCaseOnly On
</IfModule>
@josephspurrier
josephspurrier / .htaccess
Last active Aug 29, 2015
Apache sub folder configuration for Trailing Slash Solution - http://josephspurrier.com/trailing-slash-solution/
View .htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /test/
# Strip main index.php and query string
RewriteCond %{THE_REQUEST} ^GET./+test/+index\.php\?
RewriteRule . /test/? [R=301,NE,L]
# Strip multiple slashes and query string
RewriteCond %{THE_REQUEST} (.*)//(.*)
@josephspurrier
josephspurrier / contentstrip.php
Last active Aug 29, 2015
Strip content from between header and footer tags and insert into WordPress database
View contentstrip.php
<?php
function getMiddle($first, $end, $contents, $file)
{
$arrBegin = explode($first, $contents);
if (count($arrBegin) != 2)
{
echo 'Bad Begin: '.$file;
die();
View browserdetection.php
/**
* Get the OS from the HTTP_USER_AGENT string
*
* * @link http://stackoverflow.com/questions/18070154/get-operating-system-info-with-php
*
* @return string
*/
function getOS()
{
$user_agent = (isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : 'NA');
@josephspurrier
josephspurrier / index.php
Last active Aug 29, 2015
WordPress Disconnected from Themes
View index.php
<?php
/**
* Model for interfacing with a Wordpress backend
*
* @author Alex Crooks, Si digital http://sidigital.co
**/
// Just replace your WordPress index.php content with this code to test.
define('APP_PATH', dirname( __FILE__ ));
@josephspurrier
josephspurrier / disable_wordpress_editor_cleanup.php
Last active Aug 29, 2015
Disable the WordPress Editor Cleanup
View disable_wordpress_editor_cleanup.php
/**
* Disable the Visual and Text Editor p and br tag modifications when saving
*
* When you call the editor, it will automatically add a filter depending
* on which editor you have open:
* * Text Editor: add_filter('the_editor_content', 'wp_htmledit_pre');
* * Visual Editor: add_filter('the_editor_content', 'wp_richedit_pre');
*
* The only way to stop this is to remove the filter because it's applied.
* The next call after is do_action( 'media_buttons', $editor_id );
@josephspurrier
josephspurrier / centerbackground.htm
Last active Aug 29, 2015
Center a Background Image on a Webpage
View centerbackground.htm
<!DOCTYPE html>
<html lang="en" style="overflow: auto; height: 100%;">
<body style="background: #222222; margin: 0; height: 100%;">
<div style="overflow: hidden; height: 100%;">
<img id="background-image" src="https://www.gstatic.com/chat/hangouts/bg/a432eb7bf6eef1cccf7946ca20e5c2c0-NeilKremer.jpg">
</div>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<script type="text/javascript">
@josephspurrier
josephspurrier / showwinpe.go
Created Feb 1, 2015
Golang - Output PE Info
View showwinpe.go
// Copyright 2015 Joseph Spurrier
// Author: Joseph Spurrier (http://josephspurrier.com)
// License: http://www.apache.org/licenses/LICENSE-2.0.html
package main
import (
"debug/pe"
"flag"
"fmt"
You can’t perform that action at this time.