Skip to content

Instantly share code, notes, and snippets.

$('#site-tools').append('<div id="toggle-link"><a href="#">Open</a></div>');
$('#toggle-link a').click(function () {
if ($('#toggle-link').attr('class') != "open") {
$('#toggle-link').toggleClass('open');
$('#toggle-link').animate({
top: "150px"
}, 500);
$('#site-tools div.tools-wrap').animate({
top: "0"
}, 500);
@artiomchi
artiomchi / RequireHttpsPermanentAttribute.cs
Last active December 23, 2015 23:49
RequireHttpsPermanentAttribute - a subclass of the RequireHttpsAttribute that also allows HEAD requests and does a permanent redirect
/// <summary>
/// Same as the standard RequireHttps attribute, except the redirect is permanent,
/// and it doesn't throw exceptions for a HEAD request
/// </summary>
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, Inherited = true, AllowMultiple = false)]
public class RequireHttpsPermanentAttribute : RequireHttpsAttribute
{
private static String[] _allowedMethods = new[] { "GET", "HEAD" };
protected override void HandleNonHttpsRequest(AuthorizationContext filterContext)
{
@artiomchi
artiomchi / disableWeakCyphers.reg
Created September 26, 2013 10:48
Disables weak cyphers and enables new secure cyphers in IIS Second file doesn't change the server's TLS settings
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Ciphers\DES 56/56]
"Enabled"=dword:00000000
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Ciphers\NULL]
"Enabled"=dword:00000000
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Ciphers\RC2 40/128]
"Enabled"=dword:00000000
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Ciphers\RC2 56/128]
"Enabled"=dword:00000000
@artiomchi
artiomchi / testCrypto.html
Last active January 2, 2016 16:59
Small test that shows a bug in the crypto-js library, when used in Mac OS X, Safari 6
<html>
<head>
<meta charset="utf-8">
<script type="text/javascript">
var BSeed = [109,198,182,214,76,65,92,201,96,30,77,82,22,38,127,144,66,220,135,226,199,188,185,224,68,72,86,200,207,89,236,132,118,240,224,214,210,71,46,165,72,72,241,136,190,48,103,38,243,175,82,65,130,140,34,108,55,87,63,222,169,168,3,44,50,22,113,202,64,182,166,124,123,89,209,193,176,176,107,24,50,80,85,139,75,215,173,132,113,63,23,150,242,240,195,13,143,244,101,214,118,20,220,192,241,156,151,181,88,121,122,44,162,249,239,79,120,28,232,34,57,72,155,52,152,61,196,108,176,218,165,122,184,57,144,172,232,28,8,58,24,155,56,36,215,137,41,196,115,107,181,106,104,22,249,1,110,22,2,124,247,79,110,172,231,210,172,231,170,217,171,145,42,233,100,97,15,74,197,76,192,160,139,151,27,148,235,71,131,142,92,13,236,145,165,251,149,155,149,73,232,145,247,152,141,191,90,170,5,170,126,247,37,45,62,59,76,72,23,150,202,182,80,168,255,123,204,71,151,56,166,197,65,31,46,23,165,250,153,246,242,140,12,32,244,100,117,67,45,187,174,211,80,214,104,97,70,22,94,7,19
/// <summary>
/// Controls SQL transactions for a Linq Data Context.
/// Unfortunately the implementation provided by .NET does'nt work properly (transaction state isn't reset to default after using it)
/// Note: Don't trust the profiler. Even though the results show that this class doesn't work properly - it seems to work just fine!
/// </summary>
public class TransactionBroker : IDisposable
{
private DataContext _context;
public TransactionBroker(DataContext context)