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 class StringExtensions | |
{ | |
/// Like linq take - takes the first x characters | |
public static string Take(this string theString, int count, bool ellipsis = false) | |
{ | |
int lengthToTake = Math.Min(count, theString.Length); | |
var cutDownString = theString.Substring(0, lengthToTake); | |
if (ellipsis && lengthToTake < theString.Length) | |
cutDownString += "..."; |
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
//Create a rule called "adsandrate" | |
//Run Do action when "appstart" is run more than 3 times | |
// and first run is over 5 days ago | |
//Run AskToRate() and ActivateAds() on rule fire | |
EventClient.New() | |
.Add(Rule.When("adsandrate", | |
el => el.Any(e => e.Name == "appstart" | |
&& e.Occurrrences.Count > 3 | |
&& e.Occurrrences.Min() < DateTime.Now.AddDays(-5))) |
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.Globalization; | |
/// <summary> | |
/// Class to help get around the craziness of WCF DateTime formats (Use this class instead of DateTime for WebService Models) | |
/// </summary> | |
public class WCFDate |
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 app.xaml.cs | |
public App() | |
{ | |
//blah blah | |
BlobCache.LocalMachine = new IsolatedBlob(); | |
} | |
//my blob class | |
public class IsolatedBlob : PersistentBlobCache |
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 interface IValueProvider | |
{ | |
object GetValue(); | |
} | |
public interface IProviderSelector | |
{ | |
IValueProvider GetProvider(System.Reflection.PropertyInfo prop, List<IValueProvider> providers); | |
} | |
public class DataGen |
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
Application: Blend.exe | |
Framework Version: v4.0.30319 | |
Description: The process was terminated due to an unhandled exception. | |
Exception Info: System.UnauthorizedAccessException | |
Stack: | |
at System.Security.AccessControl.Win32.SetSecurityInfo(System.Security.AccessControl.ResourceType, System.String, System.Runtime.InteropServices.SafeHandle, System.Security.AccessControl.SecurityInfos, System.Security.Principal.SecurityIdentifier, System.Security.Principal.SecurityIdentifier, System.Security.AccessControl.GenericAcl, System.Security.AccessControl.GenericAcl) | |
at System.Security.AccessControl.NativeObjectSecurity.Persist(System.String, System.Runtime.InteropServices.SafeHandle, System.Security.AccessControl.AccessControlSections, System.Object) | |
at System.Security.AccessControl.NativeObjectSecurity.Persist(System.String, System.Security.AccessControl.AccessControlSections, System.Object) | |
at System.Security.AccessControl.NativeObjectSecurity.Persist(System.String, System.Security.AccessControl.AccessContro |
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 string FormatStackTrace(string stacktrace) | |
{ | |
try | |
{ | |
var response = string.Empty; | |
var lines = stacktrace.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries); | |
foreach (var rawline in lines) | |
{ | |
var line = rawline.Trim(); |
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
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
<Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets"/> | |
<PropertyGroup> | |
<DeployFiles>$(MSBuildStartupDirectory)\DeployFiles.msbuild</DeployFiles> | |
<VersionMajor>0</VersionMajor> | |
<VersionMinor>1</VersionMinor> | |
<VersionPatch></VersionPatch> | |
<BuildOutputDirectory>C:\Builds\Temp\RedStrike.Web</BuildOutputDirectory> | |
</PropertyGroup> |
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
protected ActionResult ViewOrJson(object model) | |
{ | |
return ViewOrJson(null, model); | |
} | |
protected ActionResult ViewOrJson(string viewName, object model) | |
{ | |
var useJson = false; | |
//check if its an API call | |
if (Request.Headers["Something"] != null) |
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 robot = Require<Robot>(); | |
robot.Respond("updog", msg => msg.Send("What's up dog?")); |
OlderNewer