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 bool IsValidEmail(string email) | |
{ | |
string pattern = @"^(([^<>()[\]\\.,;:\s@\""]+" | |
+ @"(\.[^<>()[\]\\.,;:\s@\""]+)*)|(\"".+\""))@" | |
+ @"((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}" | |
+ @"\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+" | |
+ @"[a-zA-Z]{2,}))$"; | |
Regex regex = new Regex(pattern); | |
return regex.IsMatch(email); | |
} |
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 class SessionDictionary : IDictionary<string,object>, IDictionary | |
{ | |
readonly HttpSessionState sessionState; | |
readonly CollectionAdapter<string> keysAdapter; | |
readonly CollectionAdapter<object> valuesAdapter; | |
public SessionDictionary(HttpSessionState sessionState) | |
{ | |
this.sessionState = sessionState; | |
keysAdapter = new CollectionAdapter<string>(sessionState.Keys); |
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.Drawing; | |
using System.Drawing.Drawing2D; | |
using System.IO; | |
using System.Net; | |
namespace Thumbnailer | |
{ | |
public static class Thumbnail | |
{ |
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
// Uses Tidy.Net | |
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Text; | |
using System.Text.RegularExpressions; | |
using Microsoft.Security.Application; | |
using TidyNet; |
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
*{font-family:"lucida grande",tahoma,verdana,arial,sans-serif} | |
.aligncenter{text-align:center} | |
body{padding:0;margin:0;color:#333;line-height:1.3} | |
body,input.textbox,select,ul.nav li a{font-size:14px} | |
.centered{margin:0 auto} | |
.floatleft{float:left} | |
.floatright{float:right} | |
h1,h2,h3,h4{margin:0;padding:0} | |
input.textbox{padding:5px} | |
select{height:31px;padding:5px} |
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
// In software engineering, the singleton pattern is a design pattern used to implement the mathematical | |
// concept of a singleton, by restricting the instantiation of a class to one object. This is useful when | |
// exactly one object is needed to coordinate actions across the system. The concept is sometimes generalized | |
// to systems that operate more efficiently when only one object exists, or that restrict the instantiation | |
// to a certain number of objects. | |
public sealed class MySingleton | |
{ | |
private static MySingleton instance; | |
private static readonly Object sync = new object(); |
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
#region " XML Serialization " | |
/// <summary> | |
/// serialize an object to XML | |
/// </summary> | |
/// <typeparam name="T">the type of the input object</typeparam> | |
/// <param name="objectToSerialize">the object to serialize</param> | |
/// <returns></returns> | |
public static string XmlSerialize<T>(T objectToSerialize) | |
{ |
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.IO; | |
using System.Security.Permissions; | |
public class Watcher | |
{ | |
public static void Main() | |
{ | |
Run(); |
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
var controllerName = ViewContext.RouteData.Values["controller"].ToString().ToLower(); | |
var actionName = ViewContext.RouteData.Values["action"].ToString().ToLower(); |
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
<?xml version="1.0" encoding="utf-8" ?> | |
<Patients> | |
<Patient EMail="[email protected]"> | |
<FirstName>LeBron</FirstName> | |
<LastName>James</LastName> | |
</Patient> | |
<Patient EMail="[email protected]"> | |
<FirstName>Kobe</FirstName> | |
<LastName>Bryant</LastName> | |
</Patient> |