Skip to content

Instantly share code, notes, and snippets.


Block or report user

Report or block zaus

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
zaus / forms-3rdparty-migrate.php
Last active Aug 29, 2015
Forms-3rdparty Migrate Hack -- quick "plugin" to upgrade from CF7-3rdparty to, or migrate settings across sites.
View forms-3rdparty-migrate.php
Plugin Name: Forms: 3rd-Party Migrate
Plugin URI:
Description: Export/Import settings for Forms-3rdparty, or migrate to/from CF7-3rdparty
Author: zaus
Version: 0.3.2
Author URI:
zaus /
Last active Aug 29, 2015
Testing Syntax Highlighting Error

// Disable Context Menu document.oncontextmenu = function () { return false };

// Disable dragging of HTML elements document.ondragstart = function () { return false };

zaus / F1-Main.cs
Last active Aug 29, 2015
Partitioning performance comparisons -- via Essentially runs each scenario 10000 times wrapped in a timer and compares the elapsed times.
View F1-Main.cs
void Main()
test(100, 9);
test(1000, 9);
test(100, 25);
test(10000, 100);
// Define other methods and classes here
void test(int populationSize, int segmentSize) {
View Sign-In-Up-Transition.markdown
zaus /
Last active Aug 29, 2015
Demonstrating potential side effects (multiple evaluation) due to fast partitioning method from Stack Overflow answer


After using the suggested Partition solution on a set of data that had calculations applied to each element before being enumerated (see scenarios below), I noticed the application took much longer. Investigated via tests.cs and discovered that each item will be evaluated twice. See differences in sideeffect in results.

Original Scenario

var items = database.Fetch(filter).ToList();
var calculatedStuff = items.Select(item => new CalculatedItem(item));
// other stuff
var file = new SomeFileHelperThing("filename");
View SimpleServer.cs
using System.IO;
// modified from RestSharp unit tests
namespace UnitTesting
using System;
using System.Net;
using System.Security;
using System.Threading;
zaus / Haacked.StringLib.ZausFormatter.cs
Created Sep 21, 2012
C# Named token replacement as an alternative to the numerical tokens of String.Format - yet another attempt at performance
View Haacked.StringLib.ZausFormatter.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
/// via original discussion
namespace Haacked.StringLib {
/// <summary>
/// Extension string methods for named token replacement
zaus / Haacked.StringLib.TestSetup.cs
Created Sep 21, 2012
Randomly create a formatting string mask for use in testing Haacked.StringLib operations, and associated tests
View Haacked.StringLib.TestSetup.cs
using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using AtifAzis.Extensions;
/// for and
namespace Tests.Haacked.StringLib {
zaus / SublevelFilterTest.cs
Created Oct 18, 2012
C# Linq Sublevel Filtering - Only return 1st-level with matching 2nd-level items, but resultset only contains matching 2nd-level items
View SublevelFilterTest.cs
public class LinqSubsetTests {
/// example class
public class Foo {
public long ID { get; set; }
public int Filterable { get; set; }
public string Name { get; set; }
public IEnumerable<Bar> Children { get; set; }
zaus / SublevelFilterTest_Order.cs
Created Oct 19, 2012 — forked from zaus/SublevelFilterTest.cs
C# Linq Sublevel Filtering - Only return 1st-level with matching 2nd-level items, but resultset only contains matching 2nd-level items; more "practical" example with Order/LineItem relationship
View SublevelFilterTest_Order.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
namespace Playground.Tests {
public class OrderSubsetTests {
#region -------------- classes ----------------
You can’t perform that action at this time.