Skip to content

Instantly share code, notes, and snippets.

@mattkruskamp
mattkruskamp / RequiredIf.js
Created August 24, 2015 08:24
Asp.Net JQuery Unobtrusive Conditional Validation
.validator.addMethod('requiredif',
function (value, element, parameters) {
var id = '#' + parameters['dependentproperty'];
// get the target value (as a string,
// as that's what actual value will be)
var targetvalue = parameters['targetvalue'];
targetvalue =
(targetvalue == null ? '' : targetvalue).toString();
@mattkruskamp
mattkruskamp / ExampleContract.cs
Created August 24, 2015 08:16
Deserializating Xml and Json
[DataContract(Name="Client")]
public class ClientData
{
[DataMember]
public int ClientId { get; set; }
}
@mattkruskamp
mattkruskamp / index.css
Last active August 29, 2015 14:01
Silly things.
/*
Fix for Windows Phone 8 device width bug
*/
@-ms-viewport {
width: device-width;
}
@mattkruskamp
mattkruskamp / MyAwesomePage.html
Created August 7, 2012 23:20
Automatically Breaking Js and Css Cache Using Build Number in Asp.Net
<script type="text/javascript" src="/js/[email protected]()"></script>
@mattkruskamp
mattkruskamp / MyExtensions.cs
Created August 7, 2012 23:18
Automatically Breaking Js and Css Cache Using Build Number in Asp.Net
public static string BuildNumber(this HtmlHelper html)
{
if (html.ViewContext.HttpContext.Cache["_buildnumber_"] == null)
{
var version = System.Reflection.Assembly
.GetExecutingAssembly().GetName().Version;
html.ViewContext.HttpContext.Cache["_buildnumber_"] =
version.Build.ToString();
}
@mattkruskamp
mattkruskamp / AssemblyInfo.cs
Created August 7, 2012 23:12
Automatically Breaking Js and Css Cache Using Build Number in Asp.Net
[assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyFileVersion("1.0.*")]
@mattkruskamp
mattkruskamp / test.js
Created July 13, 2012 00:03
JavaScript for Pinterest-Style Popup
$(document).ready(function () {
var clickableLink = $('a'),
container = $('.container'),
popup = $('.popup'),
body = $('body'),
activePosition = 0,
popupActive = false,
win = $(window);
clickableLink.click(function (e) {
@mattkruskamp
mattkruskamp / test.html
Created July 12, 2012 23:57
Test For Pinterest Style Modal Popups
<html>
<head>
<style type="text/css">
.container {
width: 100%;
color: #ccc;
}
.large-content {
width: 800px;
margin: 0px auto;
@mattkruskamp
mattkruskamp / UnAuthenticatedCacheAttribute.cs
Created June 7, 2012 02:38
OutputCache for UnAuthenticated Requests Asp.Net Mvc
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.UI;
namespace Cyberkruz
{
/// <summary>
<link rel="stylesheet" href="/css/global/nuvis.less" type="text/css" />