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
[HttpGet("GetAllCommandHandlers")] | |
public async Task<IEnumerable<string>> GetAllCommandHandlers() | |
{ | |
var genericType = typeof(ICommandHandler<>); | |
var types = AppDomain.CurrentDomain.GetAssemblies().SelectMany(x => x.GetTypes()) | |
.Where(t => t.GetInterfaces().Any(i => i.IsGenericType && i.GetGenericTypeDefinition().Equals(genericType))) | |
.Select(x => $"{x.FullName}.{x.Name}").ToList(); | |
var genericTypeWithResult = typeof(ICommandHandler<,>); | |
var typesWithresult = AppDomain.CurrentDomain.GetAssemblies().SelectMany(x => x.GetTypes()) |
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 DateTimeExtentions | |
{ | |
public static string ToDateTimeHighPrecision(this DateTime source) | |
{ | |
return source.ToString("MM/dd/yyyy h:mm:ss.fff tt"); | |
} | |
} |
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; | |
namespace FunWithPatterns.Builder | |
{ | |
public class ApplicationBuilder | |
{ | |
private string _name; | |
private string _sureName; | |
private DateTime _birthDate; |
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
{ | |
"ReactReduxComponent": { | |
"prefix": "rrcomp", | |
"body": [ | |
"import React, { PropTypes } from 'react';\r", | |
"import { connect } from 'react-redux';\r", | |
"import { bindActionCreators } from 'redux';\r", | |
"\r", | |
"class ${1:ReactComponent} extends React.Component {\r", | |
" constructor(props, context) {\r", |
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
WITH DirectReports (ManagerID, EmployeeID, Title, Level) | |
AS | |
( | |
-- Anchor member definition | |
SELECT e.ManagerID, e.EmployeeID, e.Title, | |
0 AS Level | |
FROM dbo.MyEmployees AS e | |
WHERE e.ManagerID IS NULL | |
UNION ALL | |
-- Recursive member definition |
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
namespace editors { | |
export function getEditorClasses(): FactoryConstructor[] { | |
let list = []; | |
Object.keys(this).forEach(name => { | |
let obj = this[name]; | |
if (obj.prototype instanceof editors.Factory) { | |
list.push(obj); | |
} |
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
// 3.cpp : Defines the entry point for the console application. | |
// | |
#include "stdafx.h" | |
#include <iostream> | |
#include <ctime> | |
using namespace std; | |
class Figura | |
{ |
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 | |
{ | |
static void Main(string[] args) | |
{ | |
Foo foo = new Foo(); | |
var setValue = BuildSet<Foo, string>("Bar.Name"); | |
var getValue = BuildGet<Foo, string>("Bar.Name"); | |
setValue(foo, "abc"); | |
Console.WriteLine(getValue(foo)); |
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
[AttributeUsage(AttributeTargets.Property, AllowMultiple = true)] | |
public class RequiredIfEmptyAttribute : ValidationAttribute, IClientValidatable | |
{ | |
private readonly string[] _dependentProperties; | |
public RequiredIfEmptyAttribute(params string[] dependentPropertieses) | |
{ | |
_dependentProperties = dependentPropertieses; | |
} |
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 Permutation | |
{ | |
public static IEnumerable<string> GetPermutations(string s) | |
{ | |
if (s.Length > 1) | |
return from ch in s | |
from permutation in GetPermutations(s.Remove(s.IndexOf(ch), 1)) | |
select string.Format("{0}{1}", ch, permutation); | |
else |
NewerOlder