This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static bool IsCurrentAction(this HtmlHelper htmlHelper, string action, string controller) | |
{ | |
var viewContext = htmlHelper.ViewContext; | |
var routeValues = viewContext.RouteData.Values; | |
var currentController = routeValues["controller"]; | |
var currentAction = routeValues["action"]; | |
return (currentController != null && String.Equals(currentController.ToString(), controller, StringComparison.CurrentCultureIgnoreCase)) && | |
(currentAction != null && String.Equals(currentAction.ToString(), action, StringComparison.CurrentCultureIgnoreCase)); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function() { | |
$('form').on('submit', function() { | |
var validator = $("form").validate(); | |
var errors = validator.errors(); //get the error elements, the actual labels | |
var errorsE = validator.invalidElements(); //the invalid elements themselves | |
console.log(validator.valid()); | |
console.log(errors); | |
console.log(errorsE); | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<system.net> | |
<mailSettings> | |
<smtp deliveryMethod="SpecifiedPickupDirectory"> | |
<specifiedPickupDirectory pickupDirectoryLocation="c:\temp\maildrop\"/> | |
</smtp> | |
</mailSettings> | |
</system.net> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MatchesController : ApiController | |
{ | |
private static IMatchRepository _repository; | |
public MatchesController(IMatchRepository repository) | |
{ | |
_repository = repository; | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private Image ScaleImage(Image image, int maxWidth, int maxHeight) | |
{ | |
var ratioX = (double)maxWidth / image.Width; | |
var ratioY = (double)maxHeight / image.Height; | |
var ratio = Math.Min(ratioX, ratioY); | |
var newWidth = (int)(image.Width * ratio); | |
var newHeight = (int)(image.Height * ratio); | |
var newImage = new Bitmap(newWidth, newHeight); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Imports System | |
Imports EnvDTE | |
Imports EnvDTE80 | |
Imports EnvDTE90 | |
Imports EnvDTE90a | |
Imports EnvDTE100 | |
Imports System.Diagnostics | |
Public Module Module1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//todo make this a plugin for ko | |
function makeAllPropsObservable(jsonData) { | |
////console.log(jsonData.DivisionSummaries); | |
for (x in jsonData) { | |
////console.log(x + ' ' + jsonData[x]); | |
if (!$.isFunction(jsonData[x])) { | |
if (!$.isArray(jsonData[x])) { | |
if (!$.isPlainObject(jsonData[x])) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//all should be wrapped in jquery func | |
var my = my || {}; | |
//routes setup | |
my.routes = (function () { | |
var hashBang = '#!/', //here could check if browser supports pushstate and avoid the hashbang | |
createRoute = function (route) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Parent | |
{ | |
public virtual int Id { get; set; } | |
public virtual string Name { get; set; } | |
public virtual ICollection<Child> MyChildren { get; set; } | |
} | |
public class Child | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface IGeoLocationService | |
{ | |
Location GetLocation(string street, string city, string state, string zip); | |
Location GetLocation(string address); | |
} | |
public class GoogleGeoLocationService : IGeoLocationService | |
{ | |
public Location GetLocation(string street, string city, string state, string zip) | |
{ |