This file contains 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
<div id='result'></div> |
This file contains 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 static class HtmlHelperExtensions | |
{ | |
public static MvcHtmlString SerializeToJson(this HtmlHelper helper, string javascriptVariableName, | |
object objectToSerialize) | |
{ | |
if (javascriptVariableName.Contains(" ")) | |
throw new Exception("Invalid JS variable name"); | |
return | |
MvcHtmlString.Create(String.Format("var {0}={1};", javascriptVariableName, |
This file contains 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
using System; | |
using System.Collections.Generic; | |
using System.Net; | |
using System.Net.Mail; | |
using SendGridMail; | |
public class SendGridEmailService | |
{ | |
public bool Send(string toAddress, string fromAddress, string fromAddressAlias, string subject, string body) |
This file contains 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 static class StringExtension | |
{ | |
public static string SplitByCaps(this string value) | |
{ | |
var r = new Regex(@" | |
(?<=[A-Z])(?=[A-Z][a-z]) | | |
(?<=[^A-Z])(?=[A-Z]) | | |
(?<=[A-Za-z])(?=[^A-Za-z])", RegexOptions.IgnorePatternWhitespace); | |
return r.Replace(value, " "); |
This file contains 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
// Usage: myCollection.Page(pageNumber, pageSize); | |
public static class IEnumerableExtension { | |
public static IEnumerable<T> Page<T>(this IList<T> source, int pageNumber, int pageSize) | |
{ | |
return source.Skip((pageNumber - 1) * pageSize).Take(pageSize); | |
} | |
} |
NewerOlder