Skip to content

Instantly share code, notes, and snippets.

View mfairchild365's full-sized avatar

Michael Fairchild mfairchild365

View GitHub Profile
@mfairchild365
mfairchild365 / src_Home_Router.php
Created September 1, 2011 02:30 — forked from saltybeagle/Router.php
Simple router idea, uses array of routes
<?php
class Home_Router extends Router_Template
{
public static function getViewRoutes()
{
return array('/^home$/i' => 'Home_View');
}
public static function getEditRoutes()
{
@mfairchild365
mfairchild365 / Example_ACL
Created September 15, 2011 02:55
auto load objects and check permissions.
<?php
class Example_ACL
{
public static function getActionValue($actionString)
{
switch ($actionString)
{
case 'none':
return 0;
break;
@mfairchild365
mfairchild365 / test.php
Created August 30, 2012 16:19
Simple, configureable and lightweight Spam Detector
<?php
$spamChecker = new SpamChecker();
$spamChecker->addRule('text', function($spam){
if (strpos($spam, 'test') !== false) {
return true;
}
});
echo "The following should be true" . PHP_EOL;
var_dump($spamChecker->isSpam('this is a test'));
@mfairchild365
mfairchild365 / test.php
Created August 30, 2012 16:54 — forked from saltybeagle/test.php
Simple, configureable and lightweight Spam Detector
<?php
$spamChecker = new SpamChecker();
$spamChecker->addRule(function($spam){
if (strpos($spam, 'test') !== false) {
return true;
}
});
echo "The following should be true" . PHP_EOL;
var_dump($spamChecker->isSpam('this is a test'));
@mfairchild365
mfairchild365 / example.php
Created March 19, 2014 16:45
non-utf8 characters in SOAP1.2 output with PHP
<?php
ini_set('display_errors', true);
error_reporting(E_ALL);
$options = array(
'http'=>array(
'method'=> "GET",
'header'=> "User-Agent: test\r\n"
)
);
@mfairchild365
mfairchild365 / best-20
Created January 12, 2015 03:32
Best-20 with no permits
## Rare Trade Route #534
Generated by [Elite: Dangerous Rare Trade Route Generator v1.0.0](https://github.com/cowboy/ed-rare-trade-route-generator) at 2015-01-11 18:50:05 -0600
using data from [ED_RareGoods_SystemsDistance (10/01/15 - rev 1370)](https://docs.google.com/spreadsheets/d/1haUVaFIxFq5IPqZugJ8cfCEqBrZvFFzcA-uXB4pTfW4/edit?usp=sharing).
#### Warnings
* Suboptimal sell distance: Epsilon Indi -> Thrutis (128.84 Ly)
#### Route
@mfairchild365
mfairchild365 / gist:38e9d35109ac1dc48d31
Last active August 29, 2015 14:13
perfect-jumps-12
## Rare Trade Route #3157
Generated by [Elite: Dangerous Rare Trade Route Generator v1.0.0](https://github.com/cowboy/ed-rare-trade-route-generator) at 2015-01-14 21:23:46 -0600
using data from [ED_RareGoods_SystemsDistance (12/01/15 - rev 1372)](https://docs.google.com/spreadsheets/d/1haUVaFIxFq5IPqZugJ8cfCEqBrZvFFzcA-uXB4pTfW4/edit?usp=sharing).
#### Route
Jumps: 12, Distance: 769.46 Ly
1. Rapa Bao (49.45 Ly)
@mfairchild365
mfairchild365 / test.js
Last active August 29, 2015 14:23
Test
require(['jquery', 'wdn'], function($, WDN) {
$(function() {
var $splashIntro = $('.law-intro'),
introMedia,
splashRevert = function() {
introMedia.pause();
$splashIntro.removeClass('playing');
return false;
};
@mfairchild365
mfairchild365 / twitter-title-attribute.html
Created September 1, 2015 13:41
This is a work-around for twitter widgets adding a title attribute to the iframes they produce, which leads to a11y problems.
<!--
This is a work-around for twitter widgets adding a title attribute to the iframes they produce, which leads to a11y problems.
-->
<!-- Include the twitter widget js on every page -->
<script>window.twttr = (function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0],
t = window.twttr || {};
if (d.getElementById(id)) return t;
@mfairchild365
mfairchild365 / visually-hide.css
Last active February 8, 2016 21:01
Page Titles
#main-page #pagetitle h1 {
font-size: 0;
width: 1px;
height: 1px;
display: inline-block;
overflow: hidden;
position: absolute!important;
border: 0!important;
padding: 0!important;
margin: 0!important;