Skip to content

Instantly share code, notes, and snippets.

View rarous's full-sized avatar
💭
I may be slow to respond.

Aleš Roubíček rarous

💭
I may be slow to respond.
View GitHub Profile
container.Kernel.RegistrationCompleted += (_, __) =>
{
if (registered)
return;
registered = true;
container.Kernel.GetHandler(..).ComponentModel.Interceptors.Add(..);
}
@rarous
rarous / 1.cs
Last active December 30, 2015 19:09
public interface ChangePasswordResult
{ }
public class PasswordChanged : ChangePasswordResult
{ }
public class ChangeNotAuthorized : ChangePasswordResult
{ }
public static class ChangePasswordResultEx
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Xunit;
using Xunit.Extensions;
namespace MultiConnector.Conventions.Tests
{
using ServiceBus;
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="0"/>
<xs:enumeration value="1"/>
<xs:enumeration value=""/>
</xs:restriction>
</xs:simpleType>
static string CreateQueryUrl(Maybe<string> locality, Maybe<string> street, Maybe<string> name)
{
return LocalityStreetNameQuery(locality, street, name).
Or(LocalityNameQuery(locality, name)).
Or(StreetNameQuery(street, name)).
Or(NameQuery(name)).
Return();
}
class A {
public int Prop1;
public string Prop2;
}
class B {
public int Prop1 { get; set; }
public string Prop2 { get; set; }
}
protected XElement TransformDates(XElement inputXml, string schema)
{
var inputXmlDoc = new XmlDocument();
inputXmlDoc.Load(inputXml.CreateReader());
var asm = GetType().Assembly;
//get namespace from xml
var xmlString = inputXmlDoc.DocumentElement.OuterXml;
var xPathXml = new XPathDocument(inputXml.CreateReader());
var navigator = xPathXml.CreateNavigator();
navigator.MoveToFollowing(XPathNodeType.Element);
public static DateTime ToLocalTime(this DateTime utcDate, string timeZoneId) {
var timeZone = TimeZoneInfo.FindSystemTimeZoneById(timeZoneId);
var utc = new DateTimeOffset(DateTime.SpecifyKind(utcDate, DateTimeKind.Utc));
return utc.ToOffset(timeZone.GetUtcOffset(utcDate)).DateTime;
}
public static IQueryOver<TResult, TResult> ApplyFilter<TFilter, TResult>(
this IQueryOver<TResult, TResult> query,
TFilter field,
Func<TFilter, Expression<Func<TResult, bool>>> predicate)
{
field.ToMaybe().Do(x => query.Where(predicate(x)));
return query;
}
public static IQueryOver<TResult, TResult> ApplyFilter<TField, TResult>(
bool nacteno = false;
private void metNactiFotky()
{
flowLayoutPanel1.Controls.Clear();
cesta = "D:\\PedikuraFotky\\00_Nafocene"; // v této složce mám řekněme 20 fotek
bool adrExist = Directory.Exists(cesta);