Skip to content

Instantly share code, notes, and snippets.

View alexshyba's full-sized avatar
🏀

Alex Shyba alexshyba

🏀
View GitHub Profile
@alexshyba
alexshyba / gist:6233235
Created August 14, 2013 17:19
exception
ManagedPoolThread #4 10:17:51 ERROR Cannot start profiler. The directory name is invalid.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.Directory.SetCurrentDirectory(String path)
at JetBrains.dotTrace.Api.SelfAttachImpl.StartSelfAttach(BaseProfilingConfig config, String executablePath, String savePath, UInt16 storageFmt)
at JetBrains.dotTrace.Api.SelfAttachImpl.Attach(BaseProfilingConfig config)
@alexshyba
alexshyba / IndexingProvider.cs
Created August 12, 2013 20:47
IndexingProvider.GetHistory
Log.Info("*** IndexingProvider.GetHistory(). Starting processing history collection.", new object());
var result = new HistoryEntryCollection();
foreach (HistoryEntry entry in history)
{
IEnumerable<HistoryEntry> historyEntries = from historyEntry in history
where historyEntry.Action == entry.Action && historyEntry.ItemId == entry.ItemId &&
historyEntry.ItemLanguage == entry.ItemLanguage && historyEntry.ItemVersion == entry.ItemVersion && historyEntry.Created > entry.Created
select historyEntry;
if (historyEntries.Count() > 0)
@alexshyba
alexshyba / gist:6197773
Created August 9, 2013 22:18
Playing with dotTrace SDK
var config = new JetBrains.dotTrace.Api.SaveSnapshotProfilingConfig(@"C:\perflog\publish_profiling\")
{
ProfilingControlKind = JetBrains.dotTrace.Api.ProfilingControlKind.API,
TempPath = @"C:\perflog\publish_profiling\temp",
RedistPath = @"C:\perflog\Redist\JetBrains.dotTrace.ExternalLauncherProcess.exe",
SavePath = @"C:\perflog\publish_profiling\",
SnapshotFormat = JetBrains.dotTrace.Api.SnapshotFormat.Compressed,
CoreLogMask = 6,
};
@alexshyba
alexshyba / gist:6116855
Created July 30, 2013 20:56
Subscribing to item:saved where you can access item changes and do lots of efficient exclusion.
Event.Subscribe("item:saved", this.Item_Saved);
private void Item_Saved([NotNull] object sender, [NotNull] EventArgs e)
{
var changes = Event.ExtractParameter<ItemChanges>(e, 1);
if (!changes.IsFieldModified(FieldIDs.Security) && !changes.IsFieldModified(FieldIDs.Workflow) &&
!changes.IsFieldModified(FieldIDs.WorkflowState))
{
return;