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
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| #include <time.h> | |
| unsigned char RandomByte(unsigned char maxValue) | |
| { | |
| return (unsigned char) ((unsigned long)rand() * maxValue / RAND_MAX); | |
| } |
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
| using (var ds = new NorthwindDataService()) | |
| { | |
| object cSubTree; | |
| ds.EmployeeRepository.EmployeeSubtree(2, out cSubTree); | |
| IDataReader reader = ((dynamic)cSubTree).GetDataReader(); | |
| foreach(var employee in reader.ToList<Employee>()) | |
| { | |
| Console.WriteLine("{0}, {1}", employee.FirstName, employee.LastName); | |
| } |
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
| CREATE TABLE [dbo].[OrderLines] | |
| ( | |
| [Id] int IDENTITY CONSTRAINT PK_OrderLines PRIMARY KEY NONCLUSTERED, | |
| [OrderId] [nvarchar](50) NOT NULL, | |
| [Qty] [int] NOT NULL, | |
| [Product] [nvarchar](255) NOT NULL, | |
| [Cost] [int] NOT NULL | |
| ); | |
| CREATE CLUSTERED INDEX IX_OrderLines_OrderId |
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
| using System; | |
| using System.Collections.Generic; | |
| using System.Threading; | |
| namespace ConsoleApplication1 | |
| { | |
| class Program | |
| { | |
| private static int count; |
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 UserData | |
| { | |
| public int Id { get; set; } | |
| public string Email { get; set; } | |
| } | |
| public class UserDataSearcher | |
| { | |
| private readonly Dictionary<string, List<int>> userIdsByEmail; |
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 UserData | |
| { | |
| public int Id { get; set; } | |
| public string Email { get; set; } | |
| } | |
| public class UserDataSearcher | |
| { | |
| private readonly List<UserData> userDataList; |
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
| <?xml version="1.0" encoding="utf-8" ?> | |
| <rows> | |
| <row Id="4" | |
| PostTypeId="1" | |
| Body="This is the body of question 4" | |
| Title="When setting a form's opacity should I use a decimal or double" | |
| AnswerCount="5" | |
| /> | |
| <row Id="6" |
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 Index<TItem, TKey> | |
| { | |
| private readonly SortedSet<KeyValuePair<TKey, List<TItem>>> sortedSet; | |
| public Index(IEnumerable<TItem> items, Func<TItem, TKey> keySelector, Comparer<TKey> keyComparer = null) | |
| { | |
| if (keyComparer == null) keyComparer = Comparer<TKey>.Default; | |
| var keyPairComparer = Comparer<KeyValuePair<TKey, List<TItem>>>.Create((x, y) => keyComparer.Compare(x.Key, y.Key)); | |
| var keyPairs = items.GroupBy(keySelector).Select(x => new KeyValuePair<TKey, List<TItem>>(x.Key, x.ToList())); | |
| sortedSet = new SortedSet<KeyValuePair<TKey, List<TItem>>>(keyPairs, keyPairComparer); |
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
| using MessagePack; | |
| using System; | |
| using System.Diagnostics; | |
| using System.Runtime.CompilerServices; | |
| using System.Runtime.InteropServices; | |
| using System.Threading; | |
| namespace ConsoleApp | |
| { | |
| public interface IS |
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
| import { Injectable } from '@angular/core'; | |
| import { Router, CanActivate, CanActivateChild, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router'; | |
| import { AdalService } from 'adal-angular4'; | |
| @Injectable() | |
| export class AuthenticationGuard implements CanActivate, CanActivateChild { | |
| constructor( | |
| private router: Router, | |
| private adal: AdalService | |
| ) { } |