Skip to content

Instantly share code, notes, and snippets.

View chaliy's full-sized avatar

Mykhailo Chalyi (Mike Chaliy) chaliy

  • Ukraine
  • 16:13 (UTC +03:00)
  • X @chaliy
View GitHub Profile
@chaliy
chaliy / Configure-WebBox.ps1
Created April 23, 2011 10:45
Script to configure webbox
# Connect to web-box
Enter-PsSession -ComputerName 192.0.32.10 -Credential "WS0114\Administrator"
# Prepare dependencies
Import-Module ServerManager
Import-Module WebAdministration
Import-Module BitsTransfer
# Install IIS
Add-WindowsFeature Web-Server
@chaliy
chaliy / hello_world.ps1
Created April 8, 2011 09:40
Hello World from PowerShell
write-host "Hello World!"
public Task<string> Task1(){
return TaskEx.Start(() => "abc").
ContinueWithTask(t => Task2(t.Result)); // <-- Question is here
}
public Task<string> Task2(string input){
}
public class SuperDTO
{
public string A {get; set; }
public string B {get; set; }
public string C {get; set; }
public int D {get; set; }
}
public class A{
public void M1(SuperDTO[] inp){}
@chaliy
chaliy / input_anonymous_records.cs
Created January 2, 2011 06:03
Idea of the input anonymous types
// Unlike Tupe<T1, T2, T3> this stuff has names. This is important for readability.
public void ApplyVariationsWithStocks(IEnumerable<{ String SKU,
NameValuePair[] Values,
int AvailableQty }> variations)
{
foreach(var variation in variations )
{
Console.WriteLine("SKU: {0}; Values: {1}; AvailableQty: {2}",
variation.SKU,
@chaliy
chaliy / Upgrade-Package.ps1
Created December 19, 2010 17:59
Script to upgrade all NuGet packages in solution to new version
###########################################################
#
# Script to upgrade all NuGet packages in solution to last version
#
# USAGE
# Place this file (Upgrade-Package.ps1) to your solution folder.
# From Package Manager Console execute
#
# .\Upgrade-Package.ps1 -PackageID:Castle.Core
#
@chaliy
chaliy / HtmlConsole.cs
Created October 17, 2010 17:00
Small Silverlight wrapper for FireBug or anything else that support console.
using System;
using System.Windows.Browser;
/// <summary>
/// Small wrapper for FireBug, or anything else that support console.
/// BTW IE9 supports Log, Info and Error.
/// </summary>
/// <example>
/// // Time feature of the FireBug
/// using (HtmlConsole.Time("Create and set RootVisual"))
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"
ToolsVersion="4.0" >
<ItemGroup>
<DeployFiles Include="..\Output\**\*.*" />
</ItemGroup>
<Target Name="Deploy" DependsOnTargets="_Clean">
<!-- For now Output folder does not even existis -->
<!-- MSBuild will build all stuff an put to Output folder -->
@chaliy
chaliy / BaseRepositoryStub.cs
Created August 29, 2010 18:04
BaseRepositoryStub.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using Castle.MicroKernel;
using Castle.MicroKernel.Registration;
using Commons.DomainDesign.Model;
namespace Inventory.Tests.Stubs
{
@chaliy
chaliy / DateTime2UserType.cs
Created August 26, 2010 18:26
IUserType for SQL datetime2
using System;
using System.Data;
using NHibernate;
using NHibernate.SqlTypes;
using NHibernate.UserTypes;
namespace Infrastructure.Data.NHibernate.UserTypes
{
public class DateTime2UserType : IUserType
{