Skip to content

Instantly share code, notes, and snippets.

@ChrisMcKee
ChrisMcKee / TemplateMessage.cs
Created January 4, 2013 11:36
Template Messaging (Email)
namespace Core
{
using System;
using System.Collections;
using System.Net.Mail;
using Helper;
public class TemplateMessage
{
protected Hashtable Attachments;
@ChrisMcKee
ChrisMcKee / SystemTime.cs
Created January 4, 2013 11:35
Freezable DateTime replacement
namespace Core
{
using System;
public static class SystemTime
{
public static Func<DateTime> Now = () => DateTime.Now;
public static void Freeze()
{
namespace Helper
{
using System;
using System.Configuration;
using System.Globalization;
using System.IO;
using System.Text;
/// <summary>
/// General util method
@ChrisMcKee
ChrisMcKee / AESEncryptionHelper.cs
Last active December 10, 2015 15:08
AES Encryption Helper
namespace Helper
{
using System;
using System.IO;
using System.Security.Cryptography;
using System.Text;
using System.Web;
public class AESEncryptionHelper
{
@ChrisMcKee
ChrisMcKee / CSharp Common Extensions.cs
Created January 4, 2013 11:24
Common Extensions for CSharp (.net)
namespace Helper
{
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Reflection;
using System.Text;
using System.Text.RegularExpressions;
@ChrisMcKee
ChrisMcKee / BostonStrangler.js
Created October 2, 2012 12:39
Remove Annoying GreyOut on Images (Boston.com)
javascript:(function()%7Bfunction%20callback()%7B(function(%24)%7Bvar%20jQuery%3D%24%3BjQuery(%22.bpImage%3Espan%22).hide()%7D)(jQuery.noConflict(true))%7Dvar%20s%3Ddocument.createElement(%22script%22)%3Bs.src%3D%22https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fjquery%2F1.7.1%2Fjquery.min.js%22%3Bif(s.addEventListener)%7Bs.addEventListener(%22load%22%2Ccallback%2Cfalse)%7Delse%20if(s.readyState)%7Bs.onreadystatechange%3Dcallback%7Ddocument.body.appendChild(s)%3B%7D)()
@ChrisMcKee
ChrisMcKee / ThrottleAttribute.cs
Created September 12, 2012 10:56
MVC Test Throttle Attribute
namespace Service.ServiceInterface.Utils
{
using System;
using System.Net;
using System.Web;
using System.Web.Caching;
using System.Web.Mvc;
/// <summary>
/// Decorates any MVC route that needs to have client requests limited by time.
@ChrisMcKee
ChrisMcKee / crime.py
Created September 11, 2012 22:47 — forked from koto/crime.py
It's not a crime to build a CRIME
# This is supposedly what CRIME by Juliano Rizzo and Thai Duong will do
# Algorithm by Thomas Pornin, coding by xorninja, improved by @kkotowicz
# http://security.blogoverflow.com/2012/09/how-can-you-protect-yourself-from-crime-beasts-successor/
import string
import zlib
import sys
import random
charset = string.letters + string.digits + "%/+="
@ChrisMcKee
ChrisMcKee / Token.cs
Last active October 10, 2015 07:27
Simple Encryption / Auth
namespace Encryption
{
using System;
using System.IO;
using System.Text;
using Org.BouncyCastle.Crypto;
using Org.BouncyCastle.Crypto.Engines;
using Org.BouncyCastle.Crypto.Generators;
using Org.BouncyCastle.Crypto.Modes;
using Org.BouncyCastle.Crypto.Parameters;
@ChrisMcKee
ChrisMcKee / senderror.js
Created April 4, 2012 12:40 — forked from pamelafox/senderror.js
Sending JS errors to server
function sendError(message, url, lineNum) {
var i;
// First check the URL and line number of the error
url = url || window.location.href;
lineNum = lineNum || 'None';
// If the error is from these 3rd party script URLs, we ignore
// We could also just ignore errors from all scripts that aren't our own
var scriptURLs = [