Skip to content

Instantly share code, notes, and snippets.

View hagbarddenstore's full-sized avatar

Kim Johansson hagbarddenstore

View GitHub Profile
using System;
namespace Test
{
using System.Linq.Expressions;
class Program
{
static void Main(string[] args)
{
void Main()
{
var a = new A(1);
var b = new B(2);
Console.WriteLine("Value of A: {0}", a.Value);
Console.WriteLine("Value of B: {0}", b.Value);
ChangeA(a);
Console.WriteLine("Value of A: {0}", a.Value);
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace AggregateRootTesting
{
using System.Diagnostics;
using System.Reflection;
@hagbarddenstore
hagbarddenstore / resize.php
Last active December 14, 2015 23:58
An image resizer tool written in PHP.
<?php
class Console
{
public static function WriteLine($string)
{
echo $string . PHP_EOL;
}
public static function ReadLine()
@hagbarddenstore
hagbarddenstore / HibernateUtility.java
Created June 9, 2013 20:17
I have three Maven projects in Netbeans: Domain; Server; Web. The HibernateUtility.java is defined in the Domain project at src/main/java/com/company/product/domain/HibernateUtility.java The hibernate.hbm.xml is defined in the Domain project at src/main/resources/hibernate.hbm.xml I'm trying to use HibernateUtility from the Web project, but it d…
package com.company.product.domain;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
public class HibernateUtility {
private static final SessionFactory sessionFactory;
static {
try {
public static void Main(string[] args)
{
for (var i = 0; i < 10; i++)
{
var stopwatch = Stopwatch.StartNew();
var strings = new string[4000000];
stopwatch.Stop();
public class StaticResources
{
public static IState State
{
get { return StateClass.Instance; }
}
public interface IState
{
}
@hagbarddenstore
hagbarddenstore / Test.cs
Created July 29, 2013 14:34
How to enable injection of test values.
class Test
{
private string _logFilePath;
public string LogFilePath
{
get
{
if (string.IsNullOrEmpty(_logFilePath))
{
interface ILogger
{
void Log(string message);
}
class WriteToLogFile
{
private string _logFilePath;
public string LogFilePath
Bag<Guid> ("_attendees", x =>
{
x.Key (k => {
k.Column ("LessonId");
});
x.Access (Accessor.Field);
x.Table ("LessonAttendees");
},
x => x.Element (m => m.Column ("AttendeeId")));