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 for http://stackoverflow.com/questions/3349999/net-regex-recursive-patterns | |
^(?: | |
(\w(?<Q>)) # Q1 | |
| | |
(<(?<Angler>)) #Q2 - start < | |
| | |
(\>(?<-Angler>)(?<-A>)?(?<Q>)) #Q2 - end >, match Q | |
| | |
(\[(?<Block>)) # Q3 start - [ |
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
//Sharepoint's DocumentId.FindUrlById , used for | |
// http://kobikobi.wordpress.com/2010/09/29/sharepoint-2010-using-document-id-to-link-to-a-specific-version/ | |
public static string FindUrlById(SPSite site, string docId, string versionLabel) | |
{ | |
if (site == null) | |
{ | |
throw new ArgumentNullException("site"); | |
} | |
string[] documentUrlsById = DocIdLookup.DoSearch(site, docId); |
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
// Source code of DocIdRedir.aspx | |
// Microsoft.Office.DocumentManagement.Pages | |
// DLL Folder: C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\CONFIG\BIN\Microsoft.Office.DocumentManagement.Pages.dll | |
// Used for http://kobikobi.wordpress.com/2010/09/29/sharepoint-2010-using-document-id-to-link-to-a-specific-version/ | |
[PermissionSet(SecurityAction.Demand, Name="FullTrust"), PermissionSet(SecurityAction.InheritanceDemand, Name="FullTrust")] | |
public class DocIdRedir : LayoutsPageBase | |
{ | |
// Methods | |
private static string GetSearchUrl(SPWeb web, string docId) |
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
Hello World (hw) | |
Home work (HW) | |
Are We Going To Have To Go Through ALL This Again? (AWGTHTGTATA) | |
a b c (Abc) | |
e f (ef) | |
g (g) | |
From beneath you, it devours (fbyid) |
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
1 | |
1 1 | |
1 1 9 | |
2 1 1 1 |
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.Linq; | |
using System.Text; | |
using System.Text.RegularExpressions; | |
namespace ConsoleApplication1 | |
{ | |
class Program | |
{ |
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.Text.RegularExpressions; | |
namespace ConsoleApplication1 | |
{ | |
// sample for http://kobikobi.wordpress.com/2011/04/25/net-regular-expressions-using-the-stack-state-to-understand-numeric-values/ | |
class Program | |
{ | |
static void Main(string[] args) |
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 IEnumerable<Point> GetPoints(IEnumerable<int> coordinates) | |
{ | |
var e = coordinates.GetEnumerator(); | |
while (e.MoveNext()) | |
{ | |
int x = e.Current; | |
// here I assume the length isn't odd, so I ignore the result of MoveNext | |
e.MoveNext(); | |
int y = e.Current; |
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 void ForEach(Action<T> action) | |
{ | |
if (action == null) | |
{ | |
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.match); | |
} | |
for (int i = 0; i < this._size; i++) | |
{ | |
action(this._items[i]); | |
} |
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.Web; | |
using System.Text.RegularExpressions; | |
using System.Xml.Linq; | |
public static class CassetteHelper | |
{ | |
private static readonly Regex EnsurePathRegex = new Regex(@"((?:href|src)\s*=\s*"")/(_cassette/)", | |
RegexOptions.Compiled); |
OlderNewer