Skip to content

Instantly share code, notes, and snippets.

János Orcsik janosorcsik

View GitHub Profile
@janosorcsik
janosorcsik / launch.json
Last active Jan 27, 2019
Launch.json for Electron debuggin in VS Code
View launch.json
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Electron: Main",
"protocol": "inspector",
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron",
"runtimeArgs": [
@janosorcsik
janosorcsik / DateTimeCollisionCheck.md
Last active Dec 11, 2017
DateTime collision check
View DateTimeCollisionCheck.md

Not nullable

(x.StartDate >= StartDate && x.StartDate <= EndDate ||
x.EndDate >= StartDate && x.EndDate <= EndDate ||
x.StartDate <= StartDate && x.EndDate >= EndDate)))

EndDate is nullable

((EndDate.HasValue && x.StartDate >= StartDate && x.StartDate <= EndDate.Value) ||
(!EndDate.HasValue && x.StartDate >= StartDate && x.StartDate <= DateTime.MaxValue) ||
View MethodLocationPatternConverter.cs
using log4net.Layout.Pattern;
using log4net.Core;
using System.IO;
namespace LoggerExtensions
{
public class MethodLocationPatternConverter : PatternLayoutConverter
{
protected override void Convert(TextWriter writer, LoggingEvent loggingEvent)
{
@janosorcsik
janosorcsik / Mapper.cs
Last active Dec 11, 2017
Object mapper
View Mapper.cs
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Text;
namespace ObjectExtensions
{
public static class Mapper
{
public static T SetProperty<T>(this T host, string propertyName, object value, bool hideErrors = false)
@janosorcsik
janosorcsik / XMLTools.cs
Last active Dec 11, 2017
Generic XML writer and reader with encoding
View XMLTools.cs
using System;
using System.IO;
using System.Text;
using System.Xml.Serialization;
namespace Tools
{
public class XMLTools
{
#region singleton
View FakeHQContext.cs
using System;
using System.Data.Entity;
using System.Linq;
using System.Reflection;
using Entities.HQ;
using Repositories.Contexts;
namespace TestUtils
{
public class FakeHQContext : IHQContext
@janosorcsik
janosorcsik / TestExtensions.cs
Last active Dec 11, 2017
Unit test extensions
View TestExtensions.cs
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using Web.App_Start;
View FakeDbSet.cs
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel.DataAnnotations;
using System.Data.Entity;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
@janosorcsik
janosorcsik / CheckMessageContract.cs
Last active Dec 11, 2017
Check MessageContractAttribute
View CheckMessageContract.cs
[TestMethod]
public void CheckMessageContract()
{
var m = Assembly.Load("DataContracts").GetTypes().
Where(t => t.GetCustomAttributes(typeof(MessageContractAttribute)).Any()).ToArray();
foreach (Type t in m)
{
MessageContractAttribute a = (MessageContractAttribute) t.GetCustomAttribute(typeof(MessageContractAttribute), false);
@janosorcsik
janosorcsik / MDI_CTE.sql
Last active Dec 11, 2017
Annyi sor, amennyi az intervantionumber
View MDI_CTE.sql
CREATE FUNCTION [dbo].[MDI_CTE] (@ID BIGINT)
RETURNS @MID_CTE TABLE
(
ID BIGINT,
ToothCode NVARCHAR(64),
InterventionCode NVARCHAR(16),
BNOCode NVARCHAR(16),
ToBeReported BIT,
DentistryPatientDatacardID BIGINT,
InterventionNumber INT
You can’t perform that action at this time.