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
Regex r = new Regex("(https?://[^ ]+)"); | |
myString = r.Replace(myString, "<a href=\"$1\">$1</a>"); |
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
@echo off | |
FOR /F "tokens=1,2*" %%V IN ('bcdedit') DO SET adminTest=%%V | |
IF (%adminTest%)==(Access) goto noAdmin | |
for /F "tokens=*" %%G in ('wevtutil.exe el') DO (call :do_clear "%%G") | |
echo. | |
echo goto theEnd | |
:do_clear | |
echo clearing %1 | |
wevtutil.exe cl %1 | |
goto :eof |
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.ComponentModel.DataAnnotations; | |
using System.Linq; | |
using System.Text.RegularExpressions; | |
using System.Web; | |
using System.Xml; | |
using System.Xml.Linq; | |
namespace CommonFunctions.Validation | |
{ |
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 book IsValid(string fileName, string[] extensions) { | |
return (fileName != null && !((extensions.All(fileName.EndsWith)))) | |
} |
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 Main | |
{ | |
public static void Main() | |
{ | |
var dump = ObjectDumper.Dump(user); | |
} | |
} |
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
function getQueryVariable(query, variable) { | |
if (query== '') query = window.location.search.substring(1); | |
var vars = query.split('&'); | |
for (var i = 0; i < vars.length; i++) { | |
var pair = vars[i].split('='); | |
if (decodeURIComponent(pair[0]) == variable) { | |
return decodeURIComponent(pair[1]); | |
} | |
} | |
//console.log('Query variable %s not found', variable); |
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
System.Reflection.MethodBase currentMethod = System.Reflection.MethodBase.GetCurrentMethod(); | |
System.Diagnostics.Debug.WriteLine(currentMethod.Name); | |
System.Diagnostics.Debug.WriteLine(currentMethod.DeclaringType.Name); | |
System.Diagnostics.Debug.WriteLine(currentMethod.DeclaringType.Namespace); | |
MethodBase.GetCurrentMethod().DeclaringType; |
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 AppSettingsWrapper : DynamicObject | |
{ | |
private NameValueCollection _items; | |
public AppSettingsWrapper() | |
{ | |
_items = ConfigurationManager.AppSettings; | |
} | |
public override bool TryGetMember(GetMemberBinder binder, out object result) |
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
<configuration> | |
<system.web> | |
<compilation> | |
<codeSubDirectories> | |
<add directoryName="Extensions"/> | |
</codeSubDirectories> | |
</compilation> | |
</system.web> | |
</configuration> |
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 T GetValue<T>(this NameValueCollection collection, string key) | |
{ | |
if(collection == null) | |
{ | |
throw new ArgumentNullException("collection"); | |
} | |
var value = collection[key]; | |
if(value == null) |