Skip to content

Instantly share code, notes, and snippets.

View chaliy's full-sized avatar

Mykhailo Chalyi chaliy

View GitHub Profile
@chaliy
chaliy / WorkInChildAppDomaon.cs
Created July 11, 2011 22:39
Example of the code, that runs in child AppDomain. Main goal is to remove shared static state between executions.
using System;
using System.Diagnostics;
public class Program
{
public static class Runner
{
public static int Test1 = 0;
public static void CodeInChildAppDomain()
{
public static void Main (string[] args)
{
var items = from i in new []{1}
let x = SideEffect(i)
select i;
Somemething(items);
}
public static string SideEffect(int i){
@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 -->