Skip to content

Instantly share code, notes, and snippets.

View jack128's full-sized avatar

Eugine Savin jack128

View GitHub Profile
type
TArray2 = class
strict private
class procedure SwapIfGreater<T>(var Values: array of T; const Comparer: IComparer<T>; A, B: Integer); static;
public
class procedure QuickSortFix<T>(var Values: array of T; const Comparer: IComparer<T>; L, R: Integer); static;
end;
class procedure TArray2.SwapIfGreater<T>(var Values: array of T; const Comparer: IComparer<T>; A, B: Integer);
var
program Project2;
{$APPTYPE CONSOLE}
{$R *.res}
{$define UseGenericList}
uses
WinApi.Windows, System.SysUtils, System.Classes, System.Generics.Collections;
@jack128
jack128 / 1.ammy
Created February 22, 2017 07:08
Ammy namespace/alias bug, example 2
using System
using DevExpress.Mvvm.UI
using DevExpress.Xpf.Grid
alias DonglesGridControl() {
GridControl {
ItemsSource: bind "DongleSellings1"
View: TableView {
CellStyle: Style {
@jack128
jack128 / 1.cs
Last active February 17, 2017 14:22
ammy static field bug
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reactive;
using System.Reactive.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
@jack128
jack128 / 1.ammy
Created February 16, 2017 13:07
ammy namespace Bug
using System
using System.Windows.Input
using CertMaker
using CertMaker.Wpf
using DevExpress.Mvvm.UI
using DevExpress.Xpf.Core
//using DevExpress.Xpf.Editors
using DevExpress.Xpf.Grid
alias TemplateBinding(property) {
@jack128
jack128 / ObservableWeak.cs
Last active September 24, 2015 08:56
IObservable.SubscribeWeakly
public static IDisposable SubscribeWeakly<T>(this IObservable<T> obs, Action<T> onNext)
{
// unfortunately it's not working...
return SubscribeWeakly(obs, Observer.Create(onNext));
}
public static IDisposable SubscribeWeakly<T>(this IObservable<T> obs, IObserver<T> observer)
{
var weak = new WeakReference<IObserver<T>>(observer);
var result = Disposable.Empty;
@jack128
jack128 / gist:7983236
Created December 16, 2013 06:52
javascript vs Delphi perf test. see here delphi code https://forums.embarcadero.com/thread.jspa?threadID=74930
function itg (x) { return x*x; }
var vp = 50000;
var np = 0;
var snp = np;
var step = 0.0001;
var sum = 0;
console.log('Integral calculations...');
var cnt1 = Date.now();