Skip to content

Instantly share code, notes, and snippets.

@Pzixel
Pzixel / Program.cs
Last active February 26, 2016 11:36
Sorting prototype
using System;
using System.Diagnostics;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace ConsoleApplication6
{
class Program
{
@Pzixel
Pzixel / QuickSortDualPivot.cs
Created February 26, 2016 13:53
QuickSortDualPivot
public class QuickSortDualPivot<T>
{
private readonly IComparer<T> _comparer;
public QuickSortDualPivot(IComparer<T> comparer)
{
_comparer = comparer;
}
public void Sort(T[] input)
@Pzixel
Pzixel / HasSSE.csproj
Last active March 1, 2016 14:08
Define minimal version of target framework
<Choose>
<When Condition=" $(TargetFrameworkVersion.Replace('v', '')) &gt;= 4.6 ">
<ItemGroup>
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Numerics.Vectors.4.1.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
<PropertyGroup>
public static class WinApi
{
[DllImport("shlwapi.dll", CharSet = CharSet.Unicode)]
public static extern int StrCmpLogicalW(string s1, string s2);
}
class AlphanumericComparer : IComparer<string>
{
public int Compare(string x, string y)
{
@Pzixel
Pzixel / TypedEventHandler.cs
Created March 18, 2016 10:11
TypedEventHandler
[Serializable]
public delegate void TypedEventHandler<in TSender, in TEventArgs>(
TSender sender,
TEventArgs e
) where TEventArgs : EventArgs;
@Pzixel
Pzixel / DbIndexRebuild.sql
Created March 24, 2016 08:46
Rebuilds indices in all tables in DB
USE DatabaseName --Enter the name of the database you want to reindex
DECLARE @TableName varchar(255)
DECLARE TableCursor CURSOR FOR
@Pzixel
Pzixel / BitmapHelper
Created March 31, 2016 16:05
BitmapHelper
using System;
using System.Drawing;
using System.Drawing.Imaging;
namespace Helpers
{
public static class BitmapHelper
{
struct Pixel : IEquatable<Pixel>
{
([system.reflection.assembly]::loadfile("c:\MyDLL.dll")).FullName
function runLoad(controls) {
var deferreds = [];
for (var i = 0; i < controls.length; i++) {
deferreds.push($.Deferred());
var container = $('#' + controls[i].ContainerId);
container.html('');
container.load(controls[i].ActionUrl + '?nodeName={0}&nodeType={1}'.f(nodeName, nodeType), function (j) {
return function() {
deferreds[j].resolve();
}
using System;
using System.Text;
using Microsoft.AspNet.Mvc.Rendering;
using Microsoft.AspNet.Razor.TagHelpers;
using Microsoft.Extensions.WebEncoders;
namespace WebInterface.TagHelpers
{
[HtmlTargetElement("pager", Attributes = "total-items, items-per-page")]
public class PagerTagHelper : TagHelper