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
import {map} from 'rxjs/operators'; | |
import {ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot} from '@angular/router'; | |
import {Injectable} from '@angular/core'; | |
import {Observable} from 'rxjs'; | |
import {AuthenticationService} from './services/authentication.service'; | |
import {CurrentUserService} from './services/current-user.service'; | |
@Injectable() | |
export class AuthenticationGuard implements CanActivate { | |
constructor(private _router: Router, |
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 Startup | |
{ | |
private readonly IConfiguration _configuration; | |
private readonly IHostingEnvironment _env; | |
private readonly LoggingLevelSwitch _logLevelSwitch; | |
public Startup(IConfiguration configuration, IHostingEnvironment env) | |
{ | |
_configuration = configuration; | |
_env = env; |
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
class Program | |
{ | |
private static DocumentStore _documentStore; | |
static void Main(string[] args) | |
{ | |
var connectionString = | |
$"SCRUBBED"; | |
_documentStore = DocumentStore.For(_ => | |
{ |
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 Com<T> | |
{ | |
private Thread dispatcher; | |
private Queue<T> queue; | |
private int waitTime; | |
private Object locker; | |
private Timer timer; | |
private ManualResetEvent event; | |
public event EventHandler EmptyQueueEvent; |
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
<Style TargetType="{x:Type TextBox}"> | |
<Setter Property="Validation.ErrorTemplate"> | |
<Setter.Value> | |
<ControlTemplate> | |
<Grid> | |
<Border BorderBrush="#FFCB2E2E" BorderThickness="1" Background="#11FF0000" IsHitTestVisible="False" x:Name="errorBorder"/> | |
<AdornedElementPlaceholder x:Name="placeholder" /> | |
<Popup AllowsTransparency="True" HorizontalAlignment="Right" HorizontalOffset="0" VerticalOffset="0" PopupAnimation="Fade" Placement="Right" | |
PlacementTarget="{Binding ElementName=errorBorder}" IsOpen="{Binding ElementName=placeholder, Path=AdornedElement.IsFocused, Mode=OneWay}"> | |
<StackPanel Orientation="Horizontal"> |
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 sealed class EventAggregator | |
{ | |
public static readonly EventAgregator Instance = new EventAggregator(); | |
private EventAggregator | |
{ | |
} | |
public event EventHandler PlayerDied; |
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 MySingleton | |
{ | |
public static readonly MySingleton Instance = new MySingleton(); | |
/* Private or protected constructor so only this class can instantiate itself */ | |
private MySingleton() | |
{ | |
} | |
} |
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
XDocument doc = XDocument.Load("my-xml-file.xml"); | |
foreach(XElement el in doc.Descendants("row") | |
{ | |
test.actual = el.Descendants("var").Where( x => (string)x.Attribute("name") == "account" ).Single().Attribute("value").Value; | |
test.actual = el.Descendants("var").Where( x => (string)x.Attribute("name") == "commitment").Single().Attribute("value").Value; | |
/* Repeat the above as need for additional 'var' element values */ | |
} |