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 WebApplication9.Models; | |
namespace WebApplication9 | |
{ | |
public class DemoGettingUsersInSpecificRole | |
{ | |
private readonly ApplicationDbContext _db; |
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 Base64Extensions | |
{ | |
private static readonly Lazy<char[]> EncMap = | |
new Lazy<char[]>(BuildEncodingMap); | |
private static readonly Lazy<int[]> DecMap = | |
new Lazy<int[]>(BuildDecodingMap); | |
private const char Pad = '='; |
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
<p> | |
The password input below is using the "peek-password" directive. | |
Focusing on the input will reveal the peek icon on the right side. | |
Hovering the mouse over the peek icon will cause the password value to be visible. | |
Try it! | |
</p> | |
<form ng-app="app" class="form-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
var dt = DateTime.Parse("3/1/2015 12:07 AM", CultureInfo.CurrentCulture, DateTimeStyles.AssumeUniversal); | |
var dto = new DateTimeOffset(dt); |
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; | |
using System.Collections.Concurrent; | |
using System.Collections.Generic; | |
using System.Threading.Tasks; | |
namespace CoreTechs.Common | |
{ | |
public class BufferedEnumerable<T> : IEnumerable<T> | |
{ |
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; | |
public class CharacterComparer : IEqualityComparer<char>, IEqualityComparer<string> | |
{ | |
public static readonly CharacterComparer Ordinal = new CharacterComparer(StringComparer.Ordinal); | |
public static readonly CharacterComparer OrdinalIgnoreCase = new CharacterComparer(StringComparer.OrdinalIgnoreCase); | |
public static readonly CharacterComparer CurrentCulture = new CharacterComparer(StringComparer.CurrentCulture); | |
public static readonly CharacterComparer CurrentCultureIgnoreCase = new CharacterComparer(StringComparer.CurrentCultureIgnoreCase); | |
public static readonly CharacterComparer InvariantCulture = new CharacterComparer(StringComparer.InvariantCulture); |
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
void Main() | |
{ | |
using(var l = new ReaderWriterLockSlim()) | |
{ | |
var tasks = Enumerable.Range(0,2).Select (i => | |
Task.Run(() => | |
{ | |
l.EnterUpgradeableReadLock(); | |
try | |
{ |
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 n = 1234; | |
var array = map(n.toString().split(''), parseInt); |
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 LightInjectExtensions | |
{ | |
public static void RegisterFunc<T>(this IServiceRegistry reg, Func<IServiceFactory, T> factoryFunc) | |
{ | |
if (reg == null) throw new ArgumentNullException("reg"); | |
reg.Register(sf => factoryFunc(sf)); | |
} | |
} |
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
onmessage = function(msg) { | |
// TODO: long running code that uses msg.data to figure out answer to everything | |
postMessage(42); | |
}; |