Skip to content

Instantly share code, notes, and snippets.

View jwChung's full-sized avatar

Jin-Wook Chung jwChung

View GitHub Profile
@jwChung
jwChung / payment.cs
Last active May 7, 2022 02:45
Payment Example
using System;
using System.Collections.Generic;
namespace ClassLibrary3
{
public class Program
{
public static void Main(string[] args)
{
var service = new PaymentService(
class Program
{
static void Main(string[] args)
{
var stopwatch = new Stopwatch();
stopwatch.Start();
RunParallelly().Wait();
stopwatch.Stop();
@jwChung
jwChung / UserStore.cs
Created May 15, 2017 17:25
UserStore
public class UserStore :
UserStore<User, Role, string, UserLogin, UserRole, UserClaim>
{
private bool disposed;
public UserStore(DbContext context)
: base(context)
{
}
type Result<'a> =
| Success of 'a
| Failure of string list
module Result =
let map f xResult =
match xResult with
| Success x ->
@jwChung
jwChung / factory-patterns.cs
Last active April 3, 2016 12:35
Factory Method vs Abstract Factory
using System;
namespace ClassLibrary3
{
public interface IProduct
{
}
public class Foo : IProduct
{
@jwChung
jwChung / exception1
Last active December 25, 2015 11:49
exception from slipp
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; constraint [null]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:894)
@jwChung
jwChung / gist:5812597
Created June 19, 2013 08:22
SerializableMultidimensionalArray
public class SerializableMultidimensionalArray : IXmlSerializable
{
private readonly int[,] array = new int[3, 2];
public int this[int i, int j]
{
get
{
return this.array[i, j];
}
@jwChung
jwChung / gist:5626059
Last active December 17, 2015 14:39
EF question
public class QueryingFindingEntities
{
[Fact]
public void FindingEntityByPrimaryKey()
{
using (var context = new BlogContext())
{
int execuedCount = 0;
context.RegisterCallbackStateChanged(ConnectionState.Open, () => execuedCount++);
public interface IFactory<T>
{
T Create();
}
public class CacheFactory<T> : IFactory<T>
{
private T cached;
private readonly object syncLook = new object();
public interface IPageViewTracker
{
IDisposable Track(Page page);
}
public class NamedPageViewTracker : IPageViewTracker
{
public NamedPageViewTracker(
IPageViewTracker innerTacker, IPageViewNameProvider provider)
{