Skip to content

Instantly share code, notes, and snippets.

View chaliy's full-sized avatar

Mykhailo Chalyi chaliy

View GitHub Profile
@chaliy
chaliy / Migrate.cs
Created August 10, 2011 10:27
My super migraiton
using System;
using System.Configuration;
using System.Data.Common;
public static class Migrate
{
public static void Start()
{
try
@chaliy
chaliy / events_reduce.cs
Created October 11, 2011 07:48
Reduce function for events
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OrderId = System.String;
using Address = System.String;
using System.Reactive.Subjects;
class Program
{
@chaliy
chaliy / RavenDb.cs
Created October 11, 2011 11:46
RavenDb demo for Kiev ALT.NET
// Kiev ALT.NET: NoSQL
// Install RavenDb from http://ravendb.net/ , run server
// Reference RavenDB from NuGet
// Compile and execute this code
// Enjoy
using System;
using System.Linq;
using Raven.Client.Document;
using Raven.Client.Indexes;
/// <summary>
/// Controller Factory class for instantiating controllers using the Windsor IoC container.
/// </summary>
public sealed class WindsorControllerFactory : DefaultControllerFactory
{
private readonly IWindsorContainer _container;
/// <summary>
/// Creates a new instance of the <see cref="WindsorControllerFactory"/> class.
/// </summary>
@chaliy
chaliy / Commit-Project.ps1
Created November 12, 2011 10:33
Commit to Mercurial with message from JIRA
# Usage
# Commit-Project ABB-499
# This command will commit with message from issue ABB-499
# Commit-Project ABB-499 "Foo bar"
# This command will commit with message from issue ABB-499 and "Foo bar" at the end
#
# Script may once ask you JIRA url, your user name and password.
# You can use -Verbose modifier to get more details what script do
# Requires PsGet http://psget.net/
@chaliy
chaliy / PlanB.md
Created February 15, 2012 12:58
31337 Book

Not in particular order

  1. Perfectionism
  2. Revision Control
  3. Continuous XXX
  4. Async your life
  5. Persistence
  6. Testing
  7. Communitcation
  8. GTD (o_O)
@chaliy
chaliy / gist:1837799
Created February 15, 2012 17:58 — forked from Restuta/gist:1772878
find a thread safety bug
using System;
using System.Threading;
using System.Threading.Tasks;
# Test
namespace ConsoleApplication3
{
class ThreadUnsafe
{
@chaliy
chaliy / empty.java
Created March 10, 2012 23:38
Double Braces for GWT Tests
package client;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.RootPanel;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
@chaliy
chaliy / C#.sublime-build
Created March 18, 2012 21:17
Sublime Build to compile and run C# program
{
// This build system will build your cs file to exe file and will run it
"cmd": ["del ${file/\\.cs/\\.exe/} 2>NUL", "& csc /nologo /out:${file/\\.cs/\\.exe/} $file", "& ${file/\\.cs/\\.exe/}"],
"file_regex": "^(...*?)[(]([0-9]*),([0-9]*)[)]",
// By default csc is not in your PATH, so add it to your path
// or uncomment "path" and check that it has correct value
//"path": "C:/Windows/Microsoft.NET/Framework64/v4.0.30319/",
"shell": true, // Without this sublime has hard times to parse "&" in out command line
"selector": "source.cs"
}
// Resharper says for Add method:
// Impure method is called for readonly field of value type
return (DateTimeOffset.MinValue.Add(value) > someDateTimeOffset);
// Is this false positive?