Skip to content

Instantly share code, notes, and snippets.

Caleb Ely le717

Block or report user

Report or block le717

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
def detect_ie_browser():
"""Redirect all IE visitors to a special page
informing them to get a web browser.
# For this to work, the following conditions must be met:
# 1. The visitor is using IE (doesn't matter what version)
# 2. We must not be currently requesting a static file
# (we still need page styles/resources to load)
# 3. We don't need to be directly requesting the special page
le717 / lego-backlot.pyw
Last active Jul 14, 2019
LEGO Backlot dummy server. Used to save/load player progress.
View lego-backlot.pyw
LEGO Backlot dummy server.
Used to save/load player progress.
Original PHP code by JrMasterModelBuilder.
Ported to Python by le717.
View cc_expire_validators.php
function valid_cc_expire_format($val) {
return (bool) preg_match('/\d{2}\/\d{4}/', $val);
function valid_cc_expire_value($val) {
$currentMonth = intval(date('n'));
$currentYear = intval(date('Y'));
$r = preg_match('/(\d{2})\/(\d{4})/', $val, $matches);
le717 / cloudSettings
Last active Nov 7, 2019
Visual Studio Code Settings Sync Gist
View cloudSettings
le717 / american-date.php
Created Nov 5, 2016
View american-date.php
* Convert a date to the "American" date format.
* While one may assume this function appropriately rearranges the
* date format to follow the American MM/DD/YYYY format, in reality
* and by intention, this function is very naive. All it does is replace
* all dashes and periods with a forward-slash, preserving all ordering
* and leaving that up to the caller.
* This behavior is to allow PHP to correctly parse dates in the American
View form-submit.html
<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Form submit</title>
<form method="get">
le717 / tracking-cookie.html
Created Oct 1, 2015
Expanded form of sneaky tracking cookie system as exposed in
View tracking-cookie.html
le717 / gist:c698671893aa2a1ab8ac
Last active May 9, 2018 — forked from howtogeek/gist:6b3ed7d917900229b37e
Change font to Comic Sans if reader is using Adblock (and display a message at the top)
View gist:c698671893aa2a1ab8ac
<script type="text/javascript">
var iframe = document.createElement("iframe");
iframe.height = "1px";
iframe.width = "1px"; = "ads-text-iframe";
iframe.src = "/adframe.js";
var a = [
"In a world free from ads, one font reigns supreme. COMIC SANS!",
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
from __future__ import print_function
import sys
import platform
get_input = (input if sys.version_info[:2] >= (3, 0) else raw_input)
print("You are running {0}.".format(platform.system()))
View unoptimized.php
if (PHP_OS == 'WIN32' || PHP_OS == 'WINNT') {
define('EOL', "\r\n");
} else if (PHP_OS == 'Linux') {
define('EOL', "\n");
} else {
define('EOL', "\n");
You can’t perform that action at this time.