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
| #Parameters | |
| $logFolder = "C:\Temp\logs" | |
| $logFile = "$logFolder\Warmup_$(Get-Date -Format "MM-dd-yyyy_hh-mm-ss").log" | |
| $timeoutSec = 10 | |
| $headers = @{ | |
| SOAPAction= ""; | |
| "Accept-Encoding" = "gzip,deflate"; | |
| "User-Agent" = "PowerShell/Warmup-WebApp" | |
| } | |
| $webRequests = @( |
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 static void CreatePublishingPage(ClientContext ctx, string listTitle, string pageName, string pageContent) | |
| { | |
| const string publishingPageTemplate = "<%@ Page Inherits=\"Microsoft.SharePoint.Publishing.TemplateRedirectionPage,Microsoft.SharePoint.Publishing,Version=14.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c\" %> <%@ Reference VirtualPath=\"~TemplatePageUrl\" %> <%@ Reference VirtualPath=\"~masterurl/custom.master\" %>"; | |
| var pagesList = ctx.Web.Lists.GetByTitle(listTitle); | |
| var fileInfo = new FileCreationInformation | |
| { | |
| Url = pageName, | |
| Content = Encoding.UTF8.GetBytes(publishingPageTemplate), | |
| Overwrite = true | |
| }; |
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 StackOverflow_6783264 | |
| { | |
| public class InputData | |
| { | |
| public string FirstName; | |
| public string LastName; | |
| } | |
| [ServiceContract] | |
| public interface ITest | |
| { |
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 static class LinqExtensions | |
| { | |
| public static IEnumerable<T> Flatten<T>(this T source, Func<T, IEnumerable<T>> selector) | |
| { | |
| var stack = new Stack<T>(); | |
| stack.Push(source); | |
| while (stack.Count > 0) | |
| { | |
| var current = stack.Pop(); | |
| yield return current; |
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 SessionReadonlyModule : IHttpModule | |
| { | |
| public void Init(HttpApplication context) | |
| { | |
| context.BeginRequest += Context_BeginRequest; | |
| } | |
| public void Dispose() | |
| { | |
| // Nothing to dispose. |
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
| <View> | |
| <Query> | |
| <OrderBy> | |
| <FieldRef Name="_UIVersionString"/> | |
| <FieldRef Name="LinkFileName" /> | |
| </OrderBy> | |
| <Where> | |
| <Or> | |
| <Eq> | |
| <FieldRef Name="_ModerationStatus"/> |
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
| class CachedDataSource | |
| { | |
| protected T RetrieveCachedData<T>( | |
| string cacheKey, Func<T> fallbackFunction, CacheItemPolicy cachePolicy) where T : class | |
| { | |
| var originalData = new CacheItem<Lazy<T>>(new Lazy<T>(fallbackFunction)); | |
| var cachedData = (CacheItem<Lazy<T>>)_cacheProvider.AddOrGetExisting(cacheKey, originalData, cachePolicy); | |
| if (cachedData != null) | |
| { | |
| Logger.LogMessage(SeverityLevels.Verbose, |
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 Invoke-WebRequestV2 { | |
| param ( | |
| [Parameter(Mandatory=$true)] | |
| [uri] | |
| $Uri, | |
| [Parameter(Mandatory=$false)] | |
| [string] | |
| $Method, | |
| [Parameter(Mandatory=$false)] | |
| [string] |
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
| [Reflection.Assembly]::LoadWithPartialName("System.EnterpriseServices") | Out-Null | |
| [System.EnterpriseServices.Internal.Publish] $publish = new-object System.EnterpriseServices.Internal.Publish | |
| $publish.GacInstall(<<FullFilePathToTheDll>>) |
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 StringCompressor { | |
| readonly string _value; | |
| public void StringCompressor(string value) | |
| { | |
| _value = value; | |
| } | |
| public MemoryStream ToCompressedStream1(CompressionLevel level) | |
| { |
OlderNewer