Skip to content

Instantly share code, notes, and snippets.

zaus

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
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 http://haacked.com/archive/2009/01/14/named-formats-redux.aspx
namespace Haacked.StringLib {
/// <summary>
/// Extension string methods for named token replacement
@zaus
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 http://haacked.com/archive/2009/01/14/named-formats-redux.aspx and https://gist.github.com/3763138
namespace Tests.Haacked.StringLib {
@zaus
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
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 ----------------
@zaus
zaus / _vendorize.scss
Last active Oct 11, 2015 — forked from heroheman/gist:3907611
SASS: Vendorize Mixin with editable vendors
View _vendorize.scss
// edit for whichever you care about
$vendors: 'webkit', 'moz', 'ms'; // 'webkit', 'moz', 'ms', 'o', 'khtml';
/// @summary Repeat for multiple vendor prefixes, like prefix-free processor
/// @param $property the property to repeat
/// @param $noplain set 'true' to disable prefixless option
/// @param $vendors override the global vendor list
/// @param $prefix optional additional prefix; supposed to allow keyframe specification with `@`
///
/// @see http://css-tricks.com/redesigning-with-sass/ for references
@mixin vendorize($property, $value, $noplain: false, $vendors: $vendors, $prefix:'') {
@zaus
zaus / jsperf-results.md
Created Oct 24, 2012 — forked from jlong/uri.js
URI Parsing with Javascript - regex version
View jsperf-results.md

See original gist for discussion and links.

Performance Comparison: http://jsperf.com/url-parsing/5

Testing in Chrome 22.0.1229.94 32-bit on Windows Server 2008 R2 / 7 64-bit

Test Ops/sec

Regex

@zaus
zaus / index.html
Created Nov 19, 2012
A CodePen by AKM2. Lightning -- had to save a copy because this is awesome.
View index.html
<canvas id='c'></canvas>
@zaus
zaus / AttributeExtensions.cs
Last active Dec 10, 2015
Some useful extension methods for dealing with enum flags (bitwise operations). Found at (Ofir's Blog)[http://ofirzeitoun.wordpress.com/2012/10/11/i-like-enum-enums-extension-methods/]
View AttributeExtensions.cs
using System;
using System.Collections.Generic;
using System.Linq;
namespace Ofir.Tools.Reflection
{
public static class AttributeExtensions
{
public static IEnumerable<T> GetCustomAttributes<T>(this MemberInfo memberInfo, bool inherit = false) where T : Attribute
{
@zaus
zaus / index.html
Created Jan 16, 2013
A CodePen by Jerad Gallinger. Style tiles with SCSS - Design style tiles in the browser with SCSS! Fork this in CodePen and make your own tiles. Share your tiles with clients with the Full Page link. Go CodePen Pro and update styles on the fly in Live View in a meeting with your client. It's responsive, too. Get your in-browser design on. On Git…
View index.html
<div class="header-wrapper">
<header class="group">
<h1>Style Tile<br>Template</h1>
<hgroup class="project-title">
<h2>Project name</h2>
<h3>Style tile</h3>
<h4>Version 1</h4>
</hgroup>
</header>
</div>
@zaus
zaus / FormRepo.js
Last active Nov 13, 2019
Preserve form values across page loads -- i.e. persistent forms. Uses `localStorage` to persist, `jQuery` for utilities.
View FormRepo.js
var FormRepo = function (namespace) {
/// <summary>Persistent form values, saves to localStorage</summary>
/// <param name="namespace" type="String">the namespace to store values in localStorage</param>
// should also protect per page, since we could have the same forms in various places
this.N = namespace + '.' + window.location.pathname;
};
$.extend(FormRepo.prototype, {
namespace: function (key) {
return this.N + '.' + key;
You can’t perform that action at this time.