Skip to content

Instantly share code, notes, and snippets.

View hazzik's full-sized avatar

Alex Zaytsev hazzik

  • Brisbane, Australia
View GitHub Profile
========
Array.ForEach: 341.4, Min: 338, Max: 346
Array for i != Length; ++i: 355.5, Min: 352, Max: 365
Array for ++i: 356.8, Min: 350, Max: 381
Array for: 397.9, Min: 391, Max: 420
Array for i != Length: 410.6, Min: 398, Max: 468
Array for, cached length: 413.5, Min: 399, Max: 502
Array foreach: 437.9, Min: 433, Max: 447
List<T>.ForEach: 489.7, Min: 480, Max: 540
IList<T> for, cached length: 590.5, Min: 582, Max: 619
@hazzik
hazzik / LSP.cs
Created March 26, 2014 20:32
LSP.cs
public class Rectangle {
public Rectangle(decimal width, decimal height) {
Width = width;
Height = height;
}
public decimal Area() {
return Width * Height;
}
public decimal Width { get; private set; }
public decimal Height { get; private set; }
@{
var data = new RouteValueDictionary(ViewData);
object action;
ViewData.ModelMetadata.AdditionalValues.TryGetValue("action", out action);
object controller;
ViewData.ModelMetadata.AdditionalValues.TryGetValue("controller", out controller);
object area;
ViewData.ModelMetadata.AdditionalValues.TryGetValue("area", out area);
if (!string.IsNullOrEmpty((string) area))
{
module Jekyll
class TagCloudTag < Liquid::Tag
safe = true
def initialize(tag_name, text, tokens)
super
end
def render(context)
html = ""
using System;
using System.Diagnostics;
public class Class1
{
}
public class Test1
{
private const int iterations = 10000000;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Linq;
public static class Tests
{
private static readonly IDictionary<string, IList<long>> results = new Dictionary<string, IList<long>>();
@hazzik
hazzik / gist:cdec8b4c6863e7a33bc2
Created August 13, 2014 23:13
IISExpress.cmd
for /F %i in ('appcmd list sites /text:NAME') DO @appcmd delete site %i
@hazzik
hazzik / RestClient.cs
Created August 26, 2014 23:07
Simple dynamic REST client
public class RestClient : DynamicObject
{
private readonly string _address;
public RestClient(string address)
{
this._address = address;
}
public override bool TryInvokeMember(InvokeMemberBinder binder, object[] args, out object result)
[alias]
co = checkout
ec = config --global -e
up = !git pull --rebase --prune $@ && git submodule update --init --recursive
cob = checkout -b
cm = !git add -A && git commit -m
save = !git add -A && git commit -m 'SAVEPOINT'
wip = !git add -u && git commit -m "WIP"
undo = reset HEAD~1 --mixed
amend = commit -a --amend
# BlogML import script originally sourced from:
# https://github.com/philippkueng/philippkueng.github.com/tree/30ef1570f06d33938b18d5eee7767d6641b9a779/source/_import
# Best post I could find about how to use it was here:
# http://philippkueng.ch/migrate-from-blogengine-dot-net-to-jekyll.html
#
# how to install
# --------------
# mkdir source/_importer
# cp blogml.rb to the source/_importer/ you created above
# cp your BlogML.xml to the same source/_importer/ directory