Skip to content

Instantly share code, notes, and snippets.

View martynchamberlin's full-sized avatar

Martyn Chamberlin martynchamberlin

View GitHub Profile
@martynchamberlin
martynchamberlin / sticky_footer.js
Last active December 17, 2015 19:19
Sticky footer using jQiery
@martynchamberlin
martynchamberlin / gist:5278521
Last active December 15, 2015 14:59
Force SSL on WordPress Pages, in this case, a page with an ID of 2
<?php
$using_ssl = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' || $_SERVER['SERVER_PORT'] == 443;
add_action('wp', 'check_ssl');
function check_ssl()
{
// Page ID 2 must be https
if (is_page(2) && !$using_ssl)
{
header('HTTP/1.1 301 Moved Permanently');
@martynchamberlin
martynchamberlin / gist:4515705
Last active December 11, 2015 00:19
In C#, all constructors in polymorphism will fire, starting at the top of the tree and working down. Sometimes this isn't the desired behavior. Here's a potential workaround using a simple Window Console application.
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
B myObj = new B();
// comment the next line to disable parent constructor
myObj.Initialize();
}